diff --git a/crates/game-service/src/battle_session.rs b/crates/game-service/src/battle_session.rs index e565d52..39d2790 100644 --- a/crates/game-service/src/battle_session.rs +++ b/crates/game-service/src/battle_session.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; use std::sync::Arc; -pub const SNAPSHOT_INTERVAL_TICKS: i32 = 20; +pub const SNAPSHOT_INTERVAL_TICKS: i32 = 4; pub const MAX_CATCH_UP_TICKS: i32 = 40; use std::time::Instant; use logic::battle::{ @@ -106,11 +106,20 @@ impl BattleSession { fn snapshot_message(&mut self) -> Option { let snapshot = self.mode.snapshot().ok()?; let report = verify_snapshot(&snapshot); + let unit = self + .mode + .battle + .objects + .objects + .iter() + .find(|entry| entry.stats().speed > 0) + .map(|entry| (entry.position(), entry.owner_index())); tracing::debug!( tick = self.tick, bytes = snapshot.len(), ok = report.is_ok(), - "built a battle snapshot" + unit = ?unit, + "battle snapshot" ); if !report.is_ok() { tracing::error!( diff --git a/crates/gateway/src/message_manager.rs b/crates/gateway/src/message_manager.rs index 2e1409e..ebac6d0 100644 --- a/crates/gateway/src/message_manager.rs +++ b/crates/gateway/src/message_manager.rs @@ -22,7 +22,7 @@ pub enum RoutingError { Unauthenticated(u16), } type RoutingResult = Result; -pub const BATTLE_TICK_INTERVAL: Duration = Duration::from_millis(200); +pub const BATTLE_TICK_INTERVAL: Duration = Duration::from_millis(50); pub struct MessageManager { peer: SocketAddr, config: Arc,