Quick answer: Desyncs happen when players' game states diverge so they no longer see the same thing. From non-deterministic simulation, packet loss, floating-point differences, and unsynchronized randomness or state.
A desync, where players' games fall out of agreement and show different states, is a serious multiplayer bug. It comes from the players' simulations diverging. Here's what causes desyncs in multiplayer.
Why Games Fall Out of Sync
Multiplayer relies on players' games agreeing on the shared state. A desync happens when they diverge, one player sees something different from another. The causes are things that make simulations or state differ.
- Non-deterministic simulation, the same inputs producing different results on different machines (especially in lockstep models)
- Floating-point differences, slightly different math results across hardware or platforms accumulating into divergence
- Packet loss or missed updates, a player missing data so their state falls behind or differs
- Unsynchronized randomness, random number generators producing different values on different clients
- Unsynchronized state, some state not being properly shared or replicated
- Timing differences, operations happening in different orders on different machines
In each case, the players' games stop agreeing on the state, which is a desync.
Why Desyncs Are Hard to Diagnose
Desyncs are notoriously hard because they depend on the exact divergence point, which can be subtle (a tiny floating-point difference) and only happen under specific conditions or on certain hardware. They may not reproduce in your testing, where conditions are controlled.
Bugnet captures context and errors from real player sessions, helping you see the conditions around desyncs. Since they depend on real conditions and divergence that's hard to reproduce, capturing what players experience is important for tracking them down.
Reducing Desyncs
Reducing desyncs depends on your netcode model. For deterministic lockstep, ensure true determinism (consistent math, synchronized randomness, ordered operations). For server-authoritative models, ensure the server is the source of truth and clients reconcile to it. Handling packet loss with reliable delivery or state correction helps.
Bugnet captures the errors and context around desync conditions, helping you investigate. So desyncs come from diverging simulations or state, non-determinism, floating-point differences, missed updates, unsynchronized randomness, and reducing them means ensuring agreement through determinism or server authority.
Desyncs come from diverging simulations or state, non-determinism, floating-point differences, missed updates, unsynchronized randomness. Reduce them with true determinism (lockstep) or server authority, and handle packet loss.