Multiplayer: who decides what happened?

Play this lesson

Two pilots, one sky

Kai has an idea: a Hyper Shards co-op mode, where two pilots team up to guard Nova, the space crystal, from the same wave of alien ships.

But each player's laptop runs its own copy of the game. On Kai's screen, alien 7 explodes. On Remy's, alien 7 is still flying. Which screen is right? Every multiplayer game must answer one question: who decides what happened?

Three kinds of multiplayer

Multiplayer games come in three main kinds, and the kind decides how much network code you need.

Quick check

Kai wants to try co-op Hyper Shards this weekend, with no servers and no network code at all. Which kind fits?

  1. Local co-op: two controllers on one laptop
  2. Real-time online co-op
  3. Turn-based play through Firestore
Show the answer

Local co-op: two controllers on one laptop

Local co-op runs one copy of the game on one device, so there is nothing to keep in sync. Both online kinds need a server or a database between the players.

Peer-to-peer or client-server?

Online games connect players in one of two shapes. The client is the game on each player's device.

The authoritative server

Most online action games use an authoritative server: the server runs the real game, and its word is final. Clients send only their inputs, like "input 412: left and fire". The server applies everyone's inputs, moves every ship and alien, and sends back a snapshot of where everything is now.

The server works in fixed steps called ticks. The tick rate is how many it runs per second. Riot Games runs VALORANT's servers at 128 ticks a second, so each tick must finish in under 7.8 ms.

Spot the cheat

coop-messages.log
// messages the server got from clients{ seq: 412, input: "left" }{ seq: 413, input: "fire" }{ seq: 414, hit: "alien7", points: 500 }{ seq: 415, input: "up+fire" }

Our authoritative server should refuse one of these messages. Which line?

  1. Line 2
  2. Line 3
  3. Line 4
  4. Line 5
Show the answer

Line 4

Clients may only say which buttons they pressed. Line 4 claims a result, a hit worth 500 points, which only the server may decide. Accepting nothing but inputs blocks a whole family of cheats (more in Stopping cheaters).

Prediction: move now, check later

If Kai's ship waited for the server before moving, every key press would feel late by a full ping: the time for a message to go there and back.

So the game uses client-side prediction. It moves Kai's own ship at once, guessing the server will agree. Each snapshot then says "after input 412, you were here". The game puts the ship there and replays inputs 413, 414 and on, which the server hasn't handled yet. This fix-up is reconciliation. Usually the guess was right. A big miss snaps the ship back: rubber-banding.

Interpolation: smooth other ships

Snapshots arrive in steps, and the network delivers some early and some late. Drawing Remy's ship only when a snapshot lands would make it jump.

So the game keeps the two latest snapshots and slides Remy's ship smoothly between them. This is interpolation. The price: other ships are shown slightly in the past, on purpose.

Your own ship is predicted, a little ahead. Other ships are interpolated, a little behind. Some games add lag compensation: when you fire, the server rewinds time to check what you saw.

Netcode pick

#playtest, Remy
Co-op test: my ship moves a moment after I press a key, and Kai's ship jumps around in little steps.

Which pair of fixes matches Remy's two problems?

  1. Prediction for Remy's own ship, interpolation for Kai's ship
  2. Interpolation for Remy's own ship, prediction for Kai's ship
  3. Save both ships to Firestore 60 times a second
Show the answer

Prediction for Remy's own ship, interpolation for Kai's ship

Prediction moves your own ship instantly, then reconciles with the server. Interpolation slides other ships smoothly between snapshots. Writing positions to a database 60 times a second is slow and costly, and fixes neither.

Lobbies, matchmaking and game servers

A WebSocket is a two-way connection that stays open (standardised in 2011), so server and client can send messages at any moment. Firestore suits the lobby list and the final results, but it stores data. It doesn't run a match many times a second. Where a game server lives is the topic of Your own servers.

Bolt says: Prediction for you, interpolation for everyone else, and the server has the final word. That's the heart of online action games.

Fact-checked 9 October 2026