mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix tracy not working in certain areas, add span to chunk gen, missing fmt, remove extra span, make voxygen use INFO level instead of TRACE in tracy mode
This commit is contained in:
parent
2511b8959c
commit
0127832172
@ -5,6 +5,7 @@ authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>"]
|
||||
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"]
|
||||
|
@ -5,6 +5,7 @@ name = "veloren-common-ecs"
|
||||
version = "0.8.0"
|
||||
|
||||
[features]
|
||||
tracy = ["common-base/tracy"]
|
||||
|
||||
[dependencies]
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
self.cpu_stats.end();
|
||||
data.1
|
||||
.stats
|
||||
|
@ -26,6 +26,8 @@ impl Component for Vel {
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq)]
|
||||
pub struct PreviousPhysCache {
|
||||
pub velocity_dt: Vec3<f32>,
|
||||
/// Center of bounding sphere that encompasses the entity along its path for
|
||||
/// this tick
|
||||
pub center: Vec3<f32>,
|
||||
/// Calculates a Sphere over the Entity for quick boundary checking
|
||||
pub collision_boundary: f32,
|
||||
|
@ -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<u32>) -> Vec2<u32> { 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)
|
||||
|
@ -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]
|
||||
|
@ -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"]
|
||||
|
||||
|
@ -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))
|
||||
|
@ -540,7 +540,7 @@ impl Server {
|
||||
(
|
||||
&self.state.ecs().entities(),
|
||||
&self.state.ecs().read_storage::<comp::Pos>(),
|
||||
!&self.state.ecs().read_storage::<comp::Player>(),
|
||||
!&self.state.ecs().read_storage::<Presence>(),
|
||||
self.state.ecs().read_storage::<comp::HomeChunk>().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::<comp::Player>())
|
||||
(
|
||||
&state.ecs().entities(),
|
||||
&state.read_storage::<comp::Player>(),
|
||||
)
|
||||
.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::<comp::Player>())
|
||||
(
|
||||
&state.ecs().entities(),
|
||||
&state.read_storage::<comp::Player>(),
|
||||
)
|
||||
.join()
|
||||
.find(|(_, player)| player.uuid() == uuid)
|
||||
.map(|(e, _)| e)
|
||||
}) {
|
||||
// Remove admin component if the player is ingame
|
||||
let _ = self.state.ecs().write_storage::<comp::Admin>().remove(entity);
|
||||
let _ = self
|
||||
.state
|
||||
.ecs()
|
||||
.write_storage::<comp::Admin>()
|
||||
.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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -72,7 +72,7 @@ pub fn init(settings: &Settings) -> Vec<impl Drop> {
|
||||
};
|
||||
|
||||
#[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) =
|
||||
|
@ -5,6 +5,7 @@ authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>"]
|
||||
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"
|
||||
|
Loading…
Reference in New Issue
Block a user