From 140927cbe72a7652ab9843b05f78b64a85a824c9 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:10:37 +0100 Subject: [PATCH 1/6] Clean up day coefficient code --- Cargo.toml | 2 +- common/src/shared_server_config.rs | 10 ++-------- server/src/lib.rs | 2 +- server/src/settings.rs | 4 ++++ server/src/sys/msg/register.rs | 2 +- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2c3aaa689c..dcc61e4094 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -139,7 +139,7 @@ hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] } fxhash = { version = "0.2.1" } crossbeam-utils = { version = "0.8.1"} crossbeam-channel = { version = "0.5"} -ordered-float = { version = "3", default-features = false } +ordered-float = { version = "3", default-features = false, features = ["std"] } num = { version = "0.4" } num-traits = { version = "0.2" } vek = { version = "0.15.8", features = ["serde"] } diff --git a/common/src/shared_server_config.rs b/common/src/shared_server_config.rs index 8080d66cc4..d043bc9d2f 100644 --- a/common/src/shared_server_config.rs +++ b/common/src/shared_server_config.rs @@ -4,13 +4,7 @@ use serde::{Deserialize, Serialize}; /// life. #[derive(Debug, Serialize, Deserialize, Clone)] pub struct ServerConstants { + /// How many times faster the in-game day/night cycle should be compared to + /// real time. pub day_cycle_coefficient: f64, } -impl Default for ServerConstants { - fn default() -> Self { - ServerConstants { - // == 30.0 via server settings (the default) - day_cycle_coefficient: 24.0 * 2.0, - } - } -} diff --git a/server/src/lib.rs b/server/src/lib.rs index 786ed2b928..e07e2eb4ca 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -573,7 +573,7 @@ impl Server { } let server_constants = ServerConstants { - day_cycle_coefficient: 1440.0 / settings.day_length, + day_cycle_coefficient: settings.day_cycle_coefficient(), }; let this = Self { diff --git a/server/src/settings.rs b/server/src/settings.rs index a01e420e09..5654561b19 100644 --- a/server/src/settings.rs +++ b/server/src/settings.rs @@ -324,6 +324,10 @@ impl Settings { self.day_length = default_values.day_length; } } + + /// Derive a coefficient that is the relatively speed of the in-game + /// day/night cycle compared to reality. + pub fn day_cycle_coefficient(&self) -> f64 { 1440.0 / self.day_length } } pub enum InvalidSettingsError { diff --git a/server/src/sys/msg/register.rs b/server/src/sys/msg/register.rs index cabf24a025..de138d1954 100644 --- a/server/src/sys/msg/register.rs +++ b/server/src/sys/msg/register.rs @@ -352,7 +352,7 @@ impl<'a> System<'a> for Sys { material_stats: (*read_data.material_stats).clone(), ability_map: (*read_data.ability_map).clone(), server_constants: ServerConstants { - day_cycle_coefficient: 1440.0 / read_data.settings.day_length + day_cycle_coefficient: read_data.settings.day_cycle_coefficient() }, })?; debug!("Done initial sync with client."); From 391c9ecba53b8f2914b70a903c6f714e5db8e925 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:11:37 +0100 Subject: [PATCH 2/6] Default to fullscreen --- voxygen/src/window.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxygen/src/window.rs b/voxygen/src/window.rs index 0713ad4a0e..8817f1152d 100644 --- a/voxygen/src/window.rs +++ b/voxygen/src/window.rs @@ -1380,7 +1380,7 @@ pub struct FullScreenSettings { impl Default for FullScreenSettings { fn default() -> Self { Self { - enabled: false, + enabled: true, mode: FullscreenMode::Borderless, resolution: [1920, 1080], bit_depth: None, From 0ec5ea87d797daddd4368fcceb41c4a8f5e28c01 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:12:49 +0100 Subject: [PATCH 3/6] Reduce default audio volume --- voxygen/src/settings/audio.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voxygen/src/settings/audio.rs b/voxygen/src/settings/audio.rs index a5adb20978..4275555600 100644 --- a/voxygen/src/settings/audio.rs +++ b/voxygen/src/settings/audio.rs @@ -56,9 +56,9 @@ pub struct AudioSettings { impl Default for AudioSettings { fn default() -> Self { Self { - master_volume: AudioVolume::new(1.0, false), + master_volume: AudioVolume::new(0.8, false), inactive_master_volume_perc: AudioVolume::new(0.5, false), - music_volume: AudioVolume::new(0.4, false), + music_volume: AudioVolume::new(0.3, false), sfx_volume: AudioVolume::new(0.6, false), ambience_volume: AudioVolume::new(0.6, false), num_sfx_channels: 60, From 4732d28e24ad7bff83f01c407d3775202d09172a Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:18:01 +0100 Subject: [PATCH 4/6] Reduce creature flee speed --- server/agent/src/action_nodes.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/agent/src/action_nodes.rs b/server/agent/src/action_nodes.rs index b149438c5b..d2c02a3eca 100644 --- a/server/agent/src/action_nodes.rs +++ b/server/agent/src/action_nodes.rs @@ -574,6 +574,9 @@ impl<'a> AgentData<'a> { read_data: &ReadData, tgt_pos: &Pos, ) { + // Proportion of full speed + const MAX_FLEE_SPEED: f32 = 0.65; + if read_data.is_riders.contains(*self.entity) { controller.push_event(ControlEvent::Unmount); } @@ -599,8 +602,8 @@ impl<'a> AgentData<'a> { ..self.traversal_config }, ) { - controller.inputs.move_dir = - bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) * speed; + controller.inputs.move_dir = bearing.xy().try_normalized().unwrap_or_else(Vec2::zero) + * speed.min(MAX_FLEE_SPEED); self.jump_if(bearing.z > 1.5, controller); controller.inputs.move_z = bearing.z; } From 80ebc145a8b9423fe653cb3e12809fc70949ac21 Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:20:40 +0100 Subject: [PATCH 5/6] Updated changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6b18a86d0..9a2f2f76a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 particularily noticeable when opening the map screen (which involves rescaling a few large images) and also when using the voxel minimap view (where a medium size image is updated often). - Towns now have a variety of sizes +- The game now starts in fullscreen by default +- Default audio volume should be less likely to destroy ear drums +- Creatures flee less quickly when low on health ### Removed From e7ea614607af037b005d44875617b056f8f6600a Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Sun, 14 May 2023 22:27:47 +0100 Subject: [PATCH 6/6] Fixed CI --- common/systems/tests/character_state.rs | 5 +++-- common/systems/tests/phys/basic.rs | 4 +++- common/systems/tests/phys/utils.rs | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/common/systems/tests/character_state.rs b/common/systems/tests/character_state.rs index d7a9a70558..27a785cd84 100644 --- a/common/systems/tests/character_state.rs +++ b/common/systems/tests/character_state.rs @@ -83,8 +83,9 @@ mod tests { }, false, None, - // Dummy ServerConstants - &ServerConstants::default(), + &ServerConstants { + day_cycle_coefficient: 24.0, + }, |_, _| {}, ); } diff --git a/common/systems/tests/phys/basic.rs b/common/systems/tests/phys/basic.rs index dba3fee9d0..53d5c97a5e 100644 --- a/common/systems/tests/phys/basic.rs +++ b/common/systems/tests/phys/basic.rs @@ -18,7 +18,9 @@ fn simple_run() { }, false, None, - &ServerConstants::default(), + &ServerConstants { + day_cycle_coefficient: 24.0, + }, |_, _| {}, ); } diff --git a/common/systems/tests/phys/utils.rs b/common/systems/tests/phys/utils.rs index bd2b2504c1..071e6e8761 100644 --- a/common/systems/tests/phys/utils.rs +++ b/common/systems/tests/phys/utils.rs @@ -65,7 +65,9 @@ pub fn tick(state: &mut State, dt: Duration) { }, false, None, - &ServerConstants::default(), + &ServerConstants { + day_cycle_coefficient: 24.0, + }, |_, _| {}, ); }