From 7b2357b915d9b8641cc04883673eb220888371be Mon Sep 17 00:00:00 2001 From: Mike Mueller Date: Sun, 8 Mar 2026 12:03:56 +0100 Subject: [PATCH] Improve multiplayer sync and controls responsiveness - force host snapshot on round-end transitions to prevent client desync/timeouts\n- add smoother non-host snapshot reconciliation and higher snapshot cadence\n- send periodic input heartbeats for remote control freshness\n- allow bomb placement while moving for local and multiplayer players\n- keep host-only next-round restart flow in-match --- src/game.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/game.js b/src/game.js index 5dbe9c4..59b5296 100644 --- a/src/game.js +++ b/src/game.js @@ -860,12 +860,12 @@ function applySnapshot(snapshot) { rebuildFireLookup(); } -function broadcastSnapshot() { +function broadcastSnapshot(force = false) { if (!network.isHost || state.mode !== "multiplayer" || state.screen !== "game") { return; } const t = now(); - if (t - network.lastSnapshotSentAt < 1 / SNAPSHOT_RATE) { + if (!force && t - network.lastSnapshotSentAt < 1 / SNAPSHOT_RATE) { return; } network.lastSnapshotSentAt = t; @@ -1371,9 +1371,10 @@ function checkDeaths() { function evaluateOutcome() { if (state.status !== "running") { - return; + return false; } + let endedThisFrame = false; const alivePlayers = state.players.filter((player) => player.alive); if (state.mode === "single") { @@ -1406,8 +1407,10 @@ function evaluateOutcome() { } if (state.status === "ended") { + endedThisFrame = true; openMenu(); } + return endedThisFrame; } function updateNonHostClient(dt) { @@ -1521,10 +1524,10 @@ function updateGame(dt) { collectPowerup(player); } - evaluateOutcome(); + const endedThisFrame = evaluateOutcome(); if (state.mode === "multiplayer" && network.isHost) { - broadcastSnapshot(); + broadcastSnapshot(endedThisFrame); } }