Multiplayer players out of sync
Desync happens when every player runs their own version of the game. Pick one authority, send inputs, and smooth what you show.

Key takeaways
- The top cause is no single source of truth: each client simulates and decides outcomes on its own.
- Make the room server authoritative: clients send inputs, the server decides, everyone renders the server's state.
- Jumpy remote players need interpolation, and laggy local controls need prediction with reconciliation.
- Randomness, timing by frame count, and players who join late are the classic hidden causes.
When multiplayer players get out of sync, seeing opponents in different places, landing hits that the other player never felt, or finishing with different scores, the most likely cause is that there is no single source of truth: each player's browser runs its own copy of the game and decides outcomes locally, and small differences grow. The fix is to make one authority (normally the room server) own the game state, have clients send only their inputs, and have every client draw what the server says, smoothed with interpolation. Randomness, frame-based timing and late joiners cause most of the remaining drift.
What desync looks like
- Positions differ: on your screen the opponent is at the door; on theirs, they are already inside.
- Outcomes differ: you saw the shot hit, they saw it miss; a coin is collected twice; two players both win.
- Remote players teleport or stutter instead of moving smoothly.
- Your own character rubber-bands: it moves, then snaps back.
- Drift that grows over a match: fine at first, wildly different after three minutes.
- Late joiners see a different world: missing pickups, wrong score, doors in the wrong state.
Causes, most likely first
1. Every client decides outcomes
The simplest multiplayer code broadcasts "I am here" and "I hit you" from each client. Each client trusts its own simulation. With 50 to 150 milliseconds of latency between players, they disagree about where everyone was at the moment of a hit, and both are "right" locally. It is also trivially cheatable.
Fix: an authoritative server. Clients send inputs ("move left", "fire at angle 40"), the server runs the one real simulation at a fixed tick (a common starting value is 20 to 30 ticks per second for action games), and broadcasts state snapshots. Scores, health, pickups and wins are decided only on the server. The netcode glossary entry and tick rate entry explain the vocabulary.
2. Remote players drawn at raw snapshot positions
Snapshots arrive 20 to 30 times a second, and unevenly. Drawing each one as it lands makes others jump. Fix: buffer snapshots and render remote players about 100 milliseconds in the past, interpolating between the two snapshots around that time. It looks smooth, and the small delay is invisible. Extrapolate briefly only when a snapshot is late.
3. Local input waits for the server
If your own character moves only when the server confirms, controls feel sluggish by a full round trip. Moving locally without telling the server leads to rubber-banding. Fix: client-side prediction with reconciliation. Apply your input immediately, number each input, and when a server snapshot says "processed up to input 412, you are at x", reset to that position and replay inputs 413 onward. Small corrections can be blended over a few frames instead of snapping.
4. Randomness and floating point that differ per machine
Math.random gives each client different values, so spawn positions, critical hits and loot differ. Different devices can also produce tiny floating point differences that compound in physics. Fix: generate random outcomes on the server and send the results, or share a seed and use a seeded generator everywhere when the design is deterministic lockstep. For physics-heavy games, never expect two clients' physics to agree; let the server own it.
5. Timing measured in frames instead of time
A cooldown of "30 frames" lasts half a second on a 60 Hz screen and a quarter second at 120 Hz. Movement per frame does the same. Players drift apart purely from screen refresh rates. Fix: use elapsed time or server ticks for every timer and movement, never frame counts.
6. Late joiners and dropped messages
If clients only receive events ("door opened", "coin taken"), anyone who joins late or misses a message has the wrong picture forever. Fix: on join, send a full state snapshot; then send deltas. Periodically send full state for things that matter (score, doors, pickups) so missed messages heal on their own.
7. Turn-based games: two writers at once
In board and card games, desync usually means two players acted on the same turn, or both clients wrote the board. Fix: one place validates moves (a server or a backend function), each move carries the turn number it expects, and a stale move is rejected and the client refreshes.
8. A player switched tabs or locked the phone
Browsers slow down or pause timers and animation in background tabs, and phones suspend a locked screen. A client that simulates on its own falls seconds behind and, when it returns, either fast-forwards wildly or stays out of step. Fix: the server keeps simulating regardless; when a client becomes visible again, discard its local state and resync from a fresh snapshot instead of replaying missed time.
In a Startbase game
Startbase supports both shapes. Live sync for lobbies, presence, turns and live boards runs on your backend's realtime channels; action games get a room server, one isolated server per match, which the agent builds in your project (multiplayer docs). A room server is the natural authority for the fixes above. Previews and shared preview links run a development copy of the server on every plan, so you can test with friends before publishing; on paid plans, publishing the game also publishes the server. Remember the published game uses the hosted server, updated each time you publish, so republish after a netcode fix.
The message to send the agent
In my 4-player arena game, players see each other in different positions, and hits register on one screen but not the other. Make the room server authoritative: clients send numbered inputs only, the server simulates at 30 ticks per second and decides hits, health, pickups and score, and broadcasts snapshots. Render remote players 100 ms in the past with interpolation between snapshots. Predict the local player and reconcile against the server's last processed input. Move all randomness to the server, replace frame-count timers with elapsed time, and send a full state snapshot to anyone who joins mid-match.
For a turn-based game, the brief is shorter: "validate every move in one place, attach the expected turn number, reject stale moves and resend the board." The guide on how to build a multiplayer game covers which model fits which genre.
How to test for desync
- 01Open the shared preview link on two devices side by side, ideally one on mobile data.
- 02Throttle one browser to "Slow 4G" in developer tools to simulate latency.
- 03Add a small debug readout of each player's server position and local position; the gap should stay small and shrink after corrections.
- 04Play a full match, then compare final scores on both screens. They must be identical.
- 05Join a third player halfway through and check they see the same doors, pickups and score.
Frequently asked questions
What causes desync in multiplayer games?
Most often each client deciding outcomes on its own. Latency, local randomness and frame-based timing then push the copies apart. One authoritative server fixes the root cause.
Why do other players teleport around on my screen?
Their positions are drawn the moment each network update arrives. Buffer updates and interpolate, rendering others about 100 milliseconds behind real time.
Why does my character snap back when I move?
The server disagrees with your local prediction and corrects you. Reconcile by replaying unconfirmed inputs after each correction, and blend small corrections instead of snapping.
Can I test multiplayer before publishing on Startbase?
Yes. The workspace preview and shared preview links run a development copy of your room server on every plan. Publishing the server with the game needs a paid plan.

