Authoritative server (netcode)
In multiplayer games, the server decides the true game state; clients only send inputs and predict what will happen.
In multiplayer games, an authoritative server holds the true game state and decides what happens; clients only send inputs and predict the result locally. It is the standard defense against cheating in competitive online games.
If clients decided where they are or whether they hit, cheating would be trivial. With an authoritative server, clients send inputs, the server simulates and broadcasts the result. To hide network delay, the client predicts its own movement immediately and corrects it when the server answers (client-side prediction and reconciliation), while other players are shown slightly in the past (interpolation). Valve’s notes on Source multiplayer networking and Glenn Fiedler’s Gaffer On Games describe the model in detail.
The server can run in one region or close to players at the edge; one Durable Object per match is one way to get exactly one authoritative instance per room. Turn-based or cooperative games can often accept a lighter model where one player hosts. The common mistake is adding authority late: a game built on client-decided state usually needs its networking rewritten. The server loop itself is a fixed-rate cousin of the event loop.
Sources
- Valve Developer Community: Source Multiplayer Networking developer.valvesoftware.com
- Gaffer On Games: What Every Programmer Needs To Know About Game Networking gafferongames.com
Related terms
- Durable Objects: Cloudflare’s single-instance objects with their own storage: one place in the world that owns a piece of state.
- Edge computing (Workers): Running code in data centers close to the user, on the CDN, instead of in one central region.
- Event loop: How JavaScript runs one task at a time and queues the rest: callbacks, promises (microtasks), timers and rendering.
