What is netcode?
Netcode decides who is right when two players disagree, and hides the delay between them. Here are the main models, which genres use which, and the bugs to expect.

Key takeaways
- Netcode is everything that keeps players' copies of a game in agreement despite delay: who decides, what is sent, and how lag is hidden.
- Server-authoritative netcode with prediction and interpolation is the default for action games; event syncing suits turns and boards.
- Never trust the client: the server checks moves, hits and scores, or cheaters will set their own.
Netcode is a catch-all name for the networking code in a multiplayer game: what each player sends, who has the final say on what happened, and the tricks that make a delayed connection feel immediate. Good netcode is invisible; bad netcode is the reason players blame "lag" for everything.
Picture two friends playing chess by post. Each keeps a board at home, and letters carry moves between them. Netcode is the rulebook for those letters: what goes in them, whose board wins if the two disagree, and whether you are allowed to make your next move before the reply arrives.
Who decides: authority models
- Server-authoritative. Players send inputs ("pressed left, fired"); a server runs the real game and tells everyone the result. Hardest to cheat, and the default for action games.
- Event-based shared state. Players send actions ("played card 7", "moved piece to e4") through a realtime channel, and a backend validates and stores the official state. Ideal for turns, boards, quizzes and party games.
- Peer-to-peer. Players talk directly, with no server in the middle. Cheap, but cheating and connection issues are harder to handle; most browser games avoid it.
Hiding the delay
Even 80 ms of latency makes a game unplayable if every keypress waits for the server. Four techniques fix that:
- 01Client-side prediction. Your character moves the instant you press, using the same rules the server uses. When the server's answer arrives, the client quietly corrects any difference.
- 02Reconciliation. If the server disagrees, rewind to its state and replay inputs you sent since, so corrections are small nudges instead of snaps.
- 03Entity interpolation. Other players are drawn about 100 ms in the past, sliding smoothly between snapshots that arrive at the server's tick rate.
- 04Lag compensation and rollback. The server rewinds to judge a shot by what the shooter saw. Fighting games go further with rollback: simulate ahead, then roll back and replay when the opponent's real input arrives.
Which netcode for which game
- Board, card, trivia, word games: event-based. No prediction needed (online board games).
- .io and arena games: server-authoritative at 10 to 20 ticks per second, with prediction for your own movement (how to make an .io game).
- Fast action: server-authoritative, higher tick rate, prediction, interpolation and lag compensation.
Netcode on Startbase
Startbase covers both main models (multiplayer docs): live sync over your backend's realtime channels for lobbies, presence, turns and live boards, and room servers that give action games one isolated server per match, built by the agent in your project. Previews run the room server on every plan; publishing it with the game needs a paid plan. The genre decides which you want, so say it up front. For the full walkthrough, read how to build a multiplayer game.
Make this a 2 to 6 player online arena with a room server. The server is authoritative: clients send inputs only, and the server validates movement speed, cooldowns and hits. Predict the local player's movement and reconcile with server state, interpolate others 100 ms behind, and judge shots with lag compensation up to 150 ms.
Common confusions and bugs
- Trusting the client. If the browser reports "I scored 9,999", someone will send that. The server checks rules.
- Rubber-banding. Snapping back after running ahead means prediction and server rules disagree, or packets are lost. Share the movement code between client and server.
- Netcode vs network speed. Great netcode cannot remove delay; it decides who waits and how visibly.
Frequently asked questions
What does good netcode mean?
Your own actions feel instant, other players move smoothly, hits are judged fairly, and corrections are rare and small. It is about hiding delay and settling disagreements well.
What is rollback netcode?
A technique, popular in fighting games, where each player's game runs ahead using predicted opponent inputs, then rewinds and replays a few frames when the real inputs arrive.
Do turn-based games need netcode?
They need simpler netcode: send each action, validate it on the backend, and broadcast the new state. No prediction or interpolation is required.

