diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs index e7c7efe..21f328f 100644 --- a/crates/server/src/main.rs +++ b/crates/server/src/main.rs @@ -28,7 +28,7 @@ use glam::Vec3; use shared::generator::{VoxelGenerator, WorldGenConfig}; use shared::protocol::authority::ServerStats; use shared::world::{Chunk, ChunkPos, EntityPos}; -use tracing::{debug, info, warn}; +use tracing::{debug, info, trace, warn}; use client_stream::ClientStream; use net::{NetworkServer, ServerEvent}; @@ -54,14 +54,7 @@ fn stream_chunks( cylinder_chunks(position.0.chunk, view.0, &mut desired); } - let stats = world.reconcile(&desired); - info!( - loaded = stats.loaded, - unloaded = stats.unloaded, - resident = stats.resident, - in_flight = stats.in_flight, - "streaming reconcile" - ); + world.reconcile(&desired); } fn main() -> anyhow::Result<()> { @@ -116,15 +109,20 @@ fn main() -> anyhow::Result<()> { // Loading phase: dispatch the initial region and wait for the worker pool to finish before granting control. info!("Streaming initial region"); + // The loop below spins as fast as the worker pool is polled, so progress is reported only when the resident count actually advances. Logging every iteration would emit thousands of identical lines before the endpoint is even bound. + let mut last_reported = usize::MAX; loop { schedule.run(&mut world); let server_world = world.resource::(); let resident = server_world.loaded_count(); let in_flight = server_world.in_flight_count(); - // Loading progress is simply the resident fraction of all known chunks. - let total = resident + in_flight; - debug!(resident, in_flight, total, "loading progress"); + if resident != last_reported { + // Loading progress is simply the resident fraction of all known chunks. + let total = resident + in_flight; + debug!(resident, in_flight, total, "loading progress"); + last_reported = resident; + } // The region is ready once at least one chunk has been generated and none remain in flight. if server_world.streaming_idle() && resident > 0 { @@ -251,7 +249,8 @@ fn run_simulation(world: &mut World, network: &NetworkServer) -> ! { for (id, client) in &mut clients { let delivered = client.flush(server_world, &empty_baseline); if delivered > 0 { - debug!(id, delivered, "delivered resident chunks"); + // Per-tick and per-client, so it sits below the default filter: the aggregate chunk figures in the status line cover routine operation, and this level is for tracing an individual client's deliveries. + trace!(id, delivered, "delivered resident chunks"); } }