46 · Multiplayer · 2D and 3D

Client-side prediction

Move instantly, then agree with the server.

If your own character only moves when the server confirms, every keypress waits a full round trip, and with 150 ms ping it feels like walking through mud. Prediction applies your input immediately on your machine, keeps a list of unconfirmed inputs, and when the server answers, replays them from the server's state so you rarely see a correction.

←→ moveP prediction on/offHold ◀ ▶ to move

Try this: Move with prediction off at 200 ms ping: the response is sluggish. Turn prediction on (P).

Unconfirmed inputs 0

Move left and right.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Add client-side prediction: apply local inputs immediately, tag each with a sequence number and keep unacknowledged ones, and when the server state arrives (often 0.1 s later) reset to it and replay newer inputs, smoothing small corrections instead of snapping.

40 words · one sentence to paste as is

Where it's used

Common mistakes

Different movement code on client and server so corrections happen constantly, not replaying pending inputs after a correction (rubber-banding), variable timesteps, snapping every tiny correction, and predicting other players instead of interpolating them.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.