From f63c184d138939f6c2bb4d18866c24b85e932c4b Mon Sep 17 00:00:00 2001 From: Hamcha Date: Thu, 1 Oct 2020 16:47:55 +0200 Subject: [PATCH] 100 FPS server tick LETS GOOOOOOO --- src/main.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0d54565..8f30264 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,8 +11,8 @@ use std::time::Duration; use tokio::net::{TcpListener, TcpStream}; use tokio_tungstenite::WebSocketStream; -// Minimum delay between updates, in nanoseconds -const MIN_UPDATE_NS: u32 = 1000; // 1ms +// Minimum delay between updates, in milliseconds +const MIN_UPDATE_MS: u64 = 10; struct Game { world: World, @@ -23,7 +23,7 @@ impl Actor for Game { fn started(&mut self, ctx: &mut Self::Context) { // Start update loop - ctx.run_interval(Duration::new(0, MIN_UPDATE_NS), |game, _ctx| { + ctx.run_interval(Duration::from_millis(MIN_UPDATE_MS), |game, _ctx| { game.world.run_workload("update"); }); } @@ -48,13 +48,13 @@ impl Actor for NetworkManager { } fn main() { - let env = Env::default().filter_or("LOG_LEVEL", "trace"); + let env = Env::default().filter_or("LOG_LEVEL", "info"); env_logger::init_from_env(env); let settings = Settings::new().unwrap(); let system = System::new("main"); - Game::create(|ctx| { + Game::create(|_ctx| { // Create world let world = World::default();