Quick answer: Multiplayer desync happens when players' copies of the game state diverge, so they see different things and the game becomes inconsistent. The root cause is the simulations going out of sync: non-determinism (the same inputs producing different results on different machines), missed or out-of-order state updates, or no authoritative source of truth to reconcile against. Fix it with strict determinism (for lockstep models) or an authoritative server that all clients defer to, and add desync detection (checksums) to catch divergence early.
Desync is one of the hardest multiplayer bugs: players' games drift apart until they're effectively playing different games, one sees an enemy alive that another sees dead, positions disagree, outcomes differ. It stems from the fundamental challenge of keeping multiple machines' simulations in agreement, and fixing it requires the right networking model and discipline about what can cause divergence.
Why Desync Happens
Multiplayer keeps multiple machines' game states in sync, and desync is those states diverging. The causes depend on the networking model. In deterministic lockstep (clients simulate in step from shared inputs), any non-determinism causes desync, if the same inputs produce different results on different machines (due to floating-point differences, unordered iteration, uninitialized values, platform differences, or anything not perfectly deterministic), the simulations drift apart. In state-replication/authoritative models, desync comes from missed or out-of-order updates (a client missing a state update diverges) or from clients diverging without an authority to correct them.
The common theme: something has caused two machines to hold different state, and without correction, the divergence compounds. Identifying whether you have a determinism problem (lockstep) or a state-reconciliation problem (replication) is the first step, because the fixes differ.
How to Diagnose It
Detect desync to study it, the key diagnostic tool is a checksum: periodically hash the game state on each machine and compare; when the checksums diverge, you've detected a desync and know roughly when it started, which narrows the cause. For determinism issues, this tells you the simulation diverged and at what point (so you can find what non-deterministic operation caused it). For replication issues, divergence points at missed/mishandled updates.
Capture desync occurrences with context, when they happen, what preceded them, which players/platforms, since desync that correlates with a particular action, platform, or condition points at the cause (a non-deterministic operation triggered by that action, a platform floating-point difference). Bugnet captures reports and context, so desync incidents and their patterns surface, helping you correlate divergence with its trigger.
How to Fix It
Fix according to your model. For deterministic lockstep, enforce determinism rigorously, eliminate every source of non-determinism: use deterministic math (careful with floating-point across platforms), deterministic iteration order (no unordered collections affecting simulation), initialize everything, and ensure no platform-specific or non-deterministic behavior affects the simulation. The checksum tells you when determinism broke; you hunt down the non-deterministic operation. For authoritative/replication models, establish a clear source of truth, the server is authoritative and clients defer to it, and ensure state updates are reliable and ordered (or reconciled), so a client can't permanently diverge, the authority corrects it.
Add desync detection (checksums) as standing infrastructure so future desyncs are caught immediately rather than discovered through confused players. After fixing, verify states stay in sync (checksums match) across platforms and conditions. Desync is fundamentally about ensuring all machines agree on state, either by making the simulation perfectly reproducible (determinism) or by having an authority that everyone follows, and rigorous discipline about divergence sources is what keeps multiplayer consistent.
Desync is players' states drifting apart. Either make the simulation perfectly deterministic (lockstep) or give it an authoritative server everyone follows, and use checksums to catch divergence.