Overview
Multiplayer Netcode loads the distributed-systems truth of networked games into your agent: every machine holds a different, delayed, partially-wrong view of the world, and netcode is choosing deliberately where to put the latency and who resolves disputes. Fifteen non-negotiables and two decision frameworks (choose the model by genre, and the it-feels-bad-online triage); eight references cover architecture models and authority topologies, client prediction and reconciliation, entity interpolation and lag compensation, rollback and the determinism discipline, delta compression and interest management, web transports (WebSocket/WebRTC/WebTransport), game server architecture with layered anti-cheat, and testing under simulated hostile networks. Engine-agnostic doctrine with web (Colyseus/geckos) and Rust/Bevy (lightyear/ggrs/renet) stack notes throughout.
What it grants
- 01Model selection as the first decision: rollback vs prediction vs lockstep vs relaxed sync, chosen by the genre's latency-tolerance profile
- 02Authority doctrine: one owner per fact, clients send inputs never results — cheats killed by construction
- 03Client prediction with reconciliation: shared sim code, input histories, redundant sends, smoothed corrections
- 04The three-time-domains picture: server present, predicted present, interpolated past — and which queries live where
- 05Lag compensation with bounded rewind: favor-the-shooter as a policy with limits, not an accident
- 06Determinism as engineering: seeded sim-owned RNG, iteration-order discipline, checksums, replay-driven desync hunting
- 07Bandwidth's four levers: acked deltas, quantization, send-rate priority, interest management that doubles as anti-wallhack
- 08Web transport truth: WebSocket's head-of-line ceiling, WebRTC DataChannels, WebTransport, and when each ships
- 09Server anatomy: room-based tick loops, headless CI bot matches, layered security sized to stakes
- 10The condition simulator doctrine: latency/jitter/loss sliders from week one — localhost-only netcode hasn't run
Try it like this
agent> Redesign my socket.io position-broadcast game the multiplayer-netcode way — server authority, inputs not results, prediction plus interpolation, and a bandwidth budget that survives ten players.