Skip to content

Commit

Permalink
separate tick for graph and nearby updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
JackCrumpLeys committed Aug 23, 2023
1 parent 8e1b6b3 commit eeb3b1e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/energy/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Plugin for GraphPlugin {
.add_systems(OnExit(GameState::Playing), clean_up)
.add_systems(PostUpdate, spawn_graph_components)
.add_systems(
PreUpdate,
FixedUpdate,
(
remove_old_nodes.before(GraphSystemSet::UpdateNearby),
update_nearby_recv.in_set(GraphSystemSet::UpdateNearby),
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use tracing::{span, Level};

const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
const GIT_SHA: &str = env!("GIT_SHA");
const FIXED_TIMESTEP: f32 = 1. / 10.; // 10 ticks per second

fn main() {
let mut app = App::new();
Expand All @@ -50,6 +51,7 @@ fn main() {
let _enter = span.enter();

app.insert_resource(Msaa::Sample4)
.insert_resource(FixedTime::new_from_secs(FIXED_TIMESTEP))
.add_plugins(
DefaultPlugins
.set(WindowPlugin {
Expand Down

0 comments on commit eeb3b1e

Please sign in to comment.