Learn

How does netcode work for browser games?

Updated 2026-11-23

Short answer: netcode is how a multiplayer game keeps every player's screen close enough to the same game despite network delay. Browser games mostly use one of three models: state sync (one device or server owns the world and sends changes), lockstep (only inputs travel and every device runs the same deterministic simulation), and parallel rounds (everyone plays their own copy of the same seeded round and only scores or positions travel). On top of those, prediction and smoothing hide the delay. Which one you need depends on the genre, not the engine.

The problem: everyone sees the past

A message between two players takes time: often 20–80 ms between friends on one continent, and 150–250 ms across oceans, plus jitter on mobile networks. So whatever you receive about another player is already old. Netcode decides three things:

  1. Who is right when two devices disagree (authority).
  2. What travels: the whole state, changes, inputs, or just a score.
  3. How to draw the others between updates (prediction and smoothing).

Model 1: state sync

One device, the host (or a server), runs the real game. It sends the state, or what changed, to everyone else many times a second. Other players send their inputs or intents to the host.

Joinable's shared world (Pattern A) diffs your existing state object 20 times a second, sends number changes as amounts to add, and matches array items by id. Avatars (Pattern B) send each player's input to the host, which moves everyone. Guides: board and card games, .io and arena games.

Model 2: deterministic lockstep

Only the players' commands travel. Every device runs the identical simulation from the same seed, one fixed tick at a time, applying the same commands on the same tick. Classic RTS netplay works this way.

In our own test, Firestorm, a real RTS, went out of sync between Chrome and Safari at tick 2412 because of exactly those maths functions. After the fix, a 4 v 4 battle ran 10,160 ticks with 0 differences. Guide: strategy games.

Model 3: parallel rounds

Each device runs its own copy of the game. Joinable gives them the same seed and the same start moment, and only a small summary travels: a score twice a second, or a car's position and velocity 20 times a second.

Joinable calls these full rounds (race and score profiles), and recommends them whenever they fit: they don't touch your game's state. Guides: racing games, score games.

Prediction and smoothing

Between updates, a game has to draw other players somewhere.

The rule we learned on Turbo Rally: draw and collide with the same estimate. The first version drew rivals 100 ms in the past but collided with a prediction of "now", so cars bumped into rivals that weren't where they appeared.

Rollback, and what isn't covered here

Rollback netcode (GGPO-style) predicts the other player's input, runs ahead, and rewinds and re-simulates when the real input arrives. It's what fighting games use. Joinable doesn't offer it. Neither does it offer a server running the game with lag compensation, which competitive shooters need.

Which model fits your genre

Your gameModelWith Joinable
Racer, time trial, kart gameParallel rounds, predicted rivalsrace profile
Arcade, puzzle, runner, party mini gamesParallel rounds, live scoresscore profile
Board, card, word, puzzle on one boardState sync, plus a turn checkPattern A (+ C for turns)
Platformer, top-down, casual arenaState sync, host-authoritative inputPattern B
RTS, tower defence, auto-battlerDeterministic locksteplockstep profile
Fighting gameRollbackNot built
Competitive shooterServer-authoritative, lag compensationNot built

To try any of these without writing a server, paste the prompt into your coding agent: it reads the kit, picks the model for your genre, and runs the self-test.

FAQ

What is netcode in games?

The code and the model that keep a multiplayer game consistent across players despite network delay: who is authoritative, what is sent, how often, and how other players are drawn between updates.

What's the difference between state sync and lockstep?

State sync sends the game's state, or its changes, from one authority to everyone. Lockstep sends only players' inputs, and every device runs the same deterministic simulation. Lockstep uses far less bandwidth for big worlds, but the simulation must give identical results on every device.

What netcode should a browser racing game use?

Each player owns their car, sends its position and velocity about 20 times a second, and draws rivals predicted to the present with smoothing. Bumps are shared: each device moves only its own car, by half.

Does Joinable support rollback netcode?

No. Joinable offers parallel rounds, shared-world sync and lockstep. Rollback for fighting games isn't built, and we don't recommend Joinable for them today.

Copy the prompt for your coding agent or sign up free