diff --git a/client/Cargo.toml b/client/Cargo.toml index 48d369472f..366bc4c7de 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Joshua Barretto "] edition = "2018" [features] +tracy = ["common/tracy", "common-base/tracy", "common-sys/tracy", "common-net/tracy"] simd = ["vek/platform_intrinsics"] plugins = ["common-sys/plugins"] bin_bot = ["common-ecs", "serde", "ron", "clap", "rustyline", "termcolor", "tracing-subscriber", "async-channel"] diff --git a/common/ecs/Cargo.toml b/common/ecs/Cargo.toml index 4e7c584254..342d0de80b 100644 --- a/common/ecs/Cargo.toml +++ b/common/ecs/Cargo.toml @@ -5,6 +5,7 @@ name = "veloren-common-ecs" version = "0.8.0" [features] +tracy = ["common-base/tracy"] [dependencies] @@ -16,4 +17,4 @@ specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "s [dev-dependencies] #bench -float-cmp = "0.8.0" \ No newline at end of file +float-cmp = "0.8.0" diff --git a/common/ecs/src/system.rs b/common/ecs/src/system.rs index 033ed7818d..f1459967f4 100644 --- a/common/ecs/src/system.rs +++ b/common/ecs/src/system.rs @@ -253,10 +253,7 @@ where fn run(&mut self, data: Self::SystemData) { common_base::span!(_guard, "run", &format!("{}::Sys::run", T::NAME)); self.cpu_stats.reset(); - { - common_base::span!(_guard, "run inner", &format!("{}::Sys::run inner", T::NAME)); - T::run(self, data.0); - } + T::run(self, data.0); self.cpu_stats.end(); data.1 .stats diff --git a/common/src/comp/phys.rs b/common/src/comp/phys.rs index 7731c4a0b5..fdb8d10a05 100644 --- a/common/src/comp/phys.rs +++ b/common/src/comp/phys.rs @@ -26,6 +26,8 @@ impl Component for Vel { #[derive(Copy, Clone, Default, Debug, PartialEq)] pub struct PreviousPhysCache { pub velocity_dt: Vec3, + /// Center of bounding sphere that encompasses the entity along its path for + /// this tick pub center: Vec3, /// Calculates a Sphere over the Entity for quick boundary checking pub collision_boundary: f32, diff --git a/common/src/terrain/mod.rs b/common/src/terrain/mod.rs index b108d302c3..5360b6c7c8 100644 --- a/common/src/terrain/mod.rs +++ b/common/src/terrain/mod.rs @@ -53,6 +53,9 @@ impl TerrainChunkSize { #[inline(always)] /// Convert dimensions in terms of chunks into dimensions in terms of blocks /// ``` + /// use vek::*; + /// use veloren_common::terrain::TerrainChunkSize; + /// /// assert_eq!(TerrainChunkSize::blocks(Vec2::new(3, 2)), Vec2::new(96, 64)); /// ``` pub fn blocks(chunks: Vec2) -> Vec2 { chunks * Self::RECT_SIZE } @@ -60,6 +63,9 @@ impl TerrainChunkSize { /// Calculate the world position (i.e. in blocks) at the center of this /// chunk /// ``` + /// use vek::*; + /// use veloren_common::terrain::TerrainChunkSize; + /// /// assert_eq!( /// TerrainChunkSize::center_wpos(Vec2::new(0, 2)), /// Vec2::new(16, 80) diff --git a/server-cli/Cargo.toml b/server-cli/Cargo.toml index 551295e18a..4fc4646e65 100644 --- a/server-cli/Cargo.toml +++ b/server-cli/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [features] worldgen = ["server/worldgen"] default = ["worldgen"] -tracy = ["common/tracy", "tracing-tracy", "server/tracy"] +tracy = ["common/tracy", "tracing-tracy", "server/tracy", "common-net/tracy"] plugins = ["server/plugins"] [dependencies] diff --git a/server/Cargo.toml b/server/Cargo.toml index 91f08d0356..b2634cf066 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [features] worldgen = [] -tracy = ["common/tracy"] +tracy = ["common/tracy", "common-base/tracy", "common-ecs/tracy", "common-sys/tracy", "common-net/tracy", "world/tracy"] simd = ["vek/platform_intrinsics"] plugins = ["common-sys/plugins"] diff --git a/server/src/chunk_generator.rs b/server/src/chunk_generator.rs index 556ba08bdd..de28f441c3 100644 --- a/server/src/chunk_generator.rs +++ b/server/src/chunk_generator.rs @@ -54,6 +54,7 @@ impl ChunkGenerator { let chunk_tx = self.chunk_tx.clone(); self.metrics.chunks_requested.inc(); runtime.spawn_blocking(move || { + common_base::prof_span!(_guard, "generate_chunk"); let index = index.as_index_ref(); let payload = world .generate_chunk(index, key, || cancel.load(Ordering::Relaxed)) diff --git a/server/src/lib.rs b/server/src/lib.rs index 482a913c7b..05179fb637 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -540,7 +540,7 @@ impl Server { ( &self.state.ecs().entities(), &self.state.ecs().read_storage::(), - !&self.state.ecs().read_storage::(), + !&self.state.ecs().read_storage::(), self.state.ecs().read_storage::().maybe(), ) .join() @@ -704,8 +704,7 @@ impl Server { #[cfg(feature = "tracy")] { - use common_base::tracy_client::Plot; - use common_base::tracy_client::create_plot; + use common_base::tracy_client::{create_plot, Plot}; let entity_count = self.state.ecs().entities().join().count(); static ENTITY_COUNT: Plot = create_plot!("entity count"); ENTITY_COUNT.point(entity_count as f64); @@ -945,16 +944,19 @@ impl Server { &login_provider, &mut editable_settings, &data_dir.path, - ).and_then(|uuid| { + ) + .and_then(|uuid| { let state = &self.state; - (&state.ecs().entities(), &state.read_storage::()) + ( + &state.ecs().entities(), + &state.read_storage::(), + ) .join() .find(|(_, player)| player.uuid() == uuid) .map(|(e, _)| e) }) { // Add admin component if the player is ingame let _ = self.state.ecs().write_storage().insert(entity, comp::Admin); - }; } @@ -967,32 +969,44 @@ impl Server { &login_provider, &mut editable_settings, &data_dir.path, - ).and_then(|uuid| { + ) + .and_then(|uuid| { let state = &self.state; - (&state.ecs().entities(), &state.read_storage::()) + ( + &state.ecs().entities(), + &state.read_storage::(), + ) .join() .find(|(_, player)| player.uuid() == uuid) .map(|(e, _)| e) }) { // Remove admin component if the player is ingame - let _ = self.state.ecs().write_storage::().remove(entity); + let _ = self + .state + .ecs() + .write_storage::() + .remove(entity); }; } /// Useful for testing without a client - /// view_distance: distance in chunks that are persisted, this acts like the player view - /// distance so it is actually a bit farther due to a buffer zone + /// view_distance: distance in chunks that are persisted, this acts like the + /// player view distance so it is actually a bit farther due to a buffer + /// zone pub fn create_centered_persister(&mut self, view_distance: u32) { let world_dims_chunks = self.world.sim().get_size(); let world_dims_blocks = TerrainChunkSize::blocks(world_dims_chunks); // NOTE: origin is in the corner of the map - // TODO: extend this function to have picking a random position or specifiying a position - // as options + // TODO: extend this function to have picking a random position or specifiying a + // position as options //let mut rng = rand::thread_rng(); // // Pick a random position but not to close to the edge - // let rand_pos = world_dims_blocks.map(|e| e as i32).map(|e| e / 2 + rng.gen_range(-e/2..e/2 + 1)); + // let rand_pos = world_dims_blocks.map(|e| e as i32).map(|e| e / 2 + + // rng.gen_range(-e/2..e/2 + 1)); let pos = comp::Pos(Vec3::from(world_dims_blocks.map(|e| e as f32 / 2.0))); - self.state.create_persister(pos, view_distance, &self.world, &self.index, &self.runtime).build(); + self.state + .create_persister(pos, view_distance, &self.world, &self.index, &self.runtime) + .build(); } } @@ -1023,7 +1037,7 @@ pub fn add_admin( } }), Err(err) => { - error!( + error!( ?err, "Could not find uuid for this name either the user does not exist or there was an \ error communicating with the auth server." @@ -1059,7 +1073,7 @@ pub fn remove_admin( ?err, "Could not find uuid for this name either the user does not exist or there was an \ error communicating with the auth server." - ); + ); None }, } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index 2b42391995..4c9d5342e6 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -13,7 +13,7 @@ gl = ["gfx_device_gl", "gfx_gl"] hot-anim = ["anim/use-dyn-lib"] singleplayer = ["server"] simd = ["vek/platform_intrinsics"] -tracy = ["tracing-tracy", "common/tracy"] +tracy = ["tracing-tracy", "common/tracy", "common-ecs/tracy", "common-net/tracy", "common-sys/tracy", "client/tracy"] plugins = ["client/plugins"] default = ["gl", "singleplayer", "native-dialog", "plugins", "simd"] diff --git a/voxygen/src/logging.rs b/voxygen/src/logging.rs index 5039c94316..f0b3817b71 100644 --- a/voxygen/src/logging.rs +++ b/voxygen/src/logging.rs @@ -72,7 +72,7 @@ pub fn init(settings: &Settings) -> Vec { }; #[cfg(feature = "tracy")] - let filter = base_exceptions(EnvFilter::new("")).add_directive(LevelFilter::TRACE.into()); + let filter = base_exceptions(EnvFilter::new("")).add_directive(LevelFilter::INFO.into()); // Create the terminal writer layer. let (non_blocking, _stdio_guard) = diff --git a/world/Cargo.toml b/world/Cargo.toml index 4f5e5eb48d..316e46ee25 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -5,6 +5,7 @@ authors = ["Joshua Barretto "] edition = "2018" [features] +tracy = ["common/tracy", "common-net/tracy"] simd = ["vek/platform_intrinsics"] default = ["simd"] @@ -12,6 +13,7 @@ default = ["simd"] [dependencies] common = { package = "veloren-common", path = "../common" } common-net = { package = "veloren-common-net", path = "../common/net" } + bincode = "1.3.1" bitvec = "0.21.0" enum-iterator = "0.6"