DEMO IS READY BITCHES!! FUCK YEAH MOTHERFUCKERS

Signed-off-by: Sienna Meridian Satterwhite <sienna@r3t.io>
This commit is contained in:
2026-01-05 21:15:52 +00:00
parent ffe529852d
commit 5838b2dd6a
4 changed files with 21 additions and 9 deletions

View File

@@ -289,6 +289,9 @@ fn main() {
app.add_plugins(CubePlugin); app.add_plugins(CubePlugin);
app.add_systems(Startup, initialize_offline_resources); app.add_systems(Startup, initialize_offline_resources);
// Configure fixed timestep for deterministic game logic at 60fps
app.insert_resource(Time::<Fixed>::from_hz(60.0));
// Insert control socket path as resource // Insert control socket path as resource
app.insert_resource(control::ControlSocketPath(args.control_socket.clone())); app.insert_resource(control::ControlSocketPath(args.control_socket.clone()));
app.add_systems(Startup, control::start_control_socket_system); app.add_systems(Startup, control::start_control_socket_system);

View File

@@ -185,10 +185,12 @@ impl NetworkingManager {
// Spawn background task to maintain DHT presence // Spawn background task to maintain DHT presence
let session_id_clone = session_id.clone(); let session_id_clone = session_id.clone();
let cancel_token_clone = cancel_token.clone();
tokio::spawn(crate::engine::peer_discovery::maintain_dht_presence( tokio::spawn(crate::engine::peer_discovery::maintain_dht_presence(
session_id_clone, session_id_clone,
endpoint_id, endpoint_id,
pkarr_client, pkarr_client,
cancel_token_clone,
)); ));
let manager = Self { let manager = Self {

View File

@@ -138,14 +138,21 @@ pub async fn maintain_dht_presence(
session_id: SessionId, session_id: SessionId,
our_endpoint_id: EndpointId, our_endpoint_id: EndpointId,
dht_client: pkarr::Client, dht_client: pkarr::Client,
cancel_token: tokio_util::sync::CancellationToken,
) { ) {
let mut interval = tokio::time::interval(Duration::from_secs(30 * 60)); // 30 minutes let mut interval = tokio::time::interval(Duration::from_secs(30 * 60)); // 30 minutes
loop { loop {
interval.tick().await; tokio::select! {
_ = cancel_token.cancelled() => {
if let Err(e) = publish_peer_to_dht(&session_id, our_endpoint_id, &dht_client).await { tracing::info!("DHT maintenance task shutting down");
tracing::warn!("Failed to republish to DHT: {}", e); break;
}
_ = interval.tick() => {
if let Err(e) = publish_peer_to_dht(&session_id, our_endpoint_id, &dht_client).await {
tracing::warn!("Failed to republish to DHT: {}", e);
}
}
} }
} }
} }

View File

@@ -417,9 +417,9 @@ impl Plugin for NetworkingPlugin {
.chain(), .chain(),
); );
// Update systems - handle local operations // FixedUpdate systems - game logic at locked 60fps
app.add_systems( app.add_systems(
Update, FixedUpdate,
( (
// Track Transform changes and mark NetworkedTransform as changed // Track Transform changes and mark NetworkedTransform as changed
auto_detect_transform_changes_system, auto_detect_transform_changes_system,
@@ -438,14 +438,14 @@ impl Plugin for NetworkingPlugin {
// Trigger anti-entropy sync when going online (separate from chain to allow conditional execution) // Trigger anti-entropy sync when going online (separate from chain to allow conditional execution)
app.add_systems( app.add_systems(
PostUpdate, FixedPostUpdate,
trigger_sync_on_connect trigger_sync_on_connect
.run_if(bevy::ecs::schedule::common_conditions::resource_exists::<GossipBridge>), .run_if(bevy::ecs::schedule::common_conditions::resource_exists::<GossipBridge>),
); );
// PostUpdate systems - generate and send deltas // FixedPostUpdate systems - generate and send deltas at locked 60fps
app.add_systems( app.add_systems(
PostUpdate, FixedPostUpdate,
( (
// Generate deltas for changed entities, then cleanup markers // Generate deltas for changed entities, then cleanup markers
// CRITICAL: cleanup_skip_delta_markers_system must run immediately after // CRITICAL: cleanup_skip_delta_markers_system must run immediately after