diff options
| author | metamuffin <metamuffin@disroot.org> | 2025-12-19 19:28:09 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2025-12-19 19:28:12 +0100 |
| commit | bf84f7161b9d6dc44df15f74cb1b0c0e4762e05d (patch) | |
| tree | daba6a34e65db96eb3e9d653f377843c3e4587cc | |
| parent | 9654f45253726df16592b996bc361c1d0a49bac9 (diff) | |
| download | hurrycurry-bf84f7161b9d6dc44df15f74cb1b0c0e4762e05d.tar hurrycurry-bf84f7161b9d6dc44df15f74cb1b0c0e4762e05d.tar.bz2 hurrycurry-bf84f7161b9d6dc44df15f74cb1b0c0e4762e05d.tar.zst | |
customizable server tickrate
| -rw-r--r-- | server/src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/src/main.rs b/server/src/main.rs index 0179feaa..c81d49ca 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -87,6 +87,9 @@ pub(crate) struct Args { #[cfg(feature = "register")] #[arg(long, default_value = "https://registry.hurrycurry.org")] registry_server: String, + /// Simulation steps per second. Too low values can result in unreliable collisions. + #[arg(long, default_value = "50.0")] + tickrate: f32, /// Run benchmarks, then exit #[arg(long)] benchmark: bool, @@ -132,6 +135,7 @@ async fn run(data_path: PathBuf, args: Args) -> anyhow::Result<()> { let (tx, _) = broadcast::channel::<PacketC>(128 * 1024); + let dt = 1. / args.tickrate; let config = ServerConfig { inactivity_timeout: args.inactivity_timeout, lobby: args.lobby, @@ -172,7 +176,6 @@ async fn run(data_path: PathBuf, args: Args) -> anyhow::Result<()> { { let state = state.clone(); spawn(async move { - let dt = 1. / 50.; let mut tick = interval(Duration::from_secs_f32(dt)); loop { tick.tick().await; |