100 FPS server tick LETS GOOOOOOO

This commit is contained in:
Hamcha 2020-10-01 16:47:55 +02:00
parent ff9502cffe
commit f63c184d13
Signed by: hamcha
GPG Key ID: 41467804B19A3315
1 changed files with 5 additions and 5 deletions

View File

@ -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();