FPS & 3D action

Multiplayer FPS Netcode Explained: Prediction, Interpolation and Lag Compensation

Most competitive shooters use the same core pattern: an authoritative server runs the real simulation, each client predicts its own movement so input feels instant, other players are shown slightly in the past through interpolation, and the server rewinds time when checking shots so players can hit what they saw. Each technique hides latency in a different place, and each has a cost you need to design around.

This guide explains how the pieces fit together and where the hard decisions sit. It is engine-agnostic, so it applies whether you build on Unreal, Unity or a custom stack. If your shooter needs multiplayer built properly from the start, our multiplayer FPS development services cover netcode alongside gameplay.

Why shooters need special netcode

A shooter asks two things that conflict with physics. Players expect their own movement and shots to respond instantly, and they expect to hit an enemy exactly where they see one on screen. But every message between client and server takes time, and that time varies. Without compensation, your own character would feel sluggish and every enemy would be somewhere other than where they appear.

Shooter netcode is a set of deliberate illusions that make the game feel immediate while keeping one authoritative version of the truth.

The authoritative server

In the standard model, clients send inputs (move forward, look by this much, fire) and the server simulates the game, decides outcomes and sends back state. Clients never tell the server "I hit that player" or "I am at this position" as fact. This is the foundation of cheat resistance: a modified client can send odd inputs, but it cannot directly award itself kills or teleport.

The server runs at a fixed tick rate, simulating the world a set number of times per second and sending snapshots to clients. Higher tick rates reduce some latency effects and improve hit registration accuracy, but cost more server CPU and bandwidth. The right value depends on your game's pace, player count and hosting budget, so measure rather than copying another game.

Client-side prediction

If the client waited for the server before moving, every keypress would feel delayed by a full round trip. Instead, the client runs the same movement code locally as soon as the input happens and shows the result immediately. It also stores each input with a sequence number.

For prediction to work, movement code must be deterministic enough that client and server produce the same result from the same input. That shapes how you write gameplay code: movement should depend only on inputs and state that both sides share, not on frame rate or client-only data.

Server reconciliation

The server eventually sends back the authoritative position along with the last input it processed. The client compares that with what it predicted at that point. If they match, nothing happens. If they differ (because of a collision with another player, a server-side effect or packet loss), the client snaps to the server state and replays all inputs it has sent since, arriving at a corrected present.

Good reconciliation is invisible most of the time. When corrections are frequent or large, players feel rubber-banding. Smoothing small corrections over a few frames helps, but the real fix is keeping client and server simulations as close as possible.

Entity interpolation

Other players are not predicted the same way, because the client does not know their future inputs. Instead, the client buffers incoming snapshots and renders remote players by interpolating between two known past states. This makes their movement smooth even if snapshots arrive unevenly.

The cost is that you always see other players slightly in the past, by roughly the interpolation buffer plus your latency. A larger buffer handles jitter and packet loss better but increases that delay. Some games extrapolate briefly when snapshots are late, which hides gaps but can show players moving in the wrong direction for a moment.

Lag compensation

Because you see enemies in the past, a shot that is perfectly on target on your screen would miss on the server, where the enemy has already moved. Lag compensation fixes this. When the server receives a fire input, it estimates what that client was seeing at the time, temporarily rewinds other players' hitboxes to those past positions, performs the hit check, then restores the present.

This makes shooting fair for the shooter, at the expense of the target. The well-known side effect is being hit after you have already reached cover on your own screen, because the shooter saw you a moment earlier. Most games cap how far back the server will rewind so that players with very high latency cannot hit targets from too far in the past.

Summary of the techniques

TechniqueProblem it hidesCost or side effect
Authoritative serverCheating and conflicting versions of the gameServer hosting and latency on every outcome
Client predictionInput delay on your own movement and actionsRequires shared, deterministic gameplay code
ReconciliationPrediction errorsVisible corrections when client and server diverge
InterpolationJittery remote playersRemote players shown slightly in the past
Lag compensationMissing targets you aimed at correctlyTargets can be hit after reaching cover

Weapons, projectiles and abilities

Hitscan weapons fit lag compensation neatly because the check is instant. Projectiles are harder: you can simulate them only on the server (accurate but delayed), spawn a predicted visual projectile on the client and reconcile with the server's, or use a hybrid where fast projectiles are lag-compensated at spawn. Abilities that move players, such as dashes or teleports, need to be part of the predicted movement code or they will fight with reconciliation.

Feedback design depends on these choices. Effects like muzzle flash and recoil should always play locally and instantly. Damage and kills come from the server. The weapon feel guide covers how to keep feedback responsive without lying to the player.

Peer-to-peer, listen servers and dedicated servers

Dedicated servers give the fairest experience and best cheat resistance, and they are standard for competitive shooters. Listen servers, where one player hosts, are cheaper but give that player an advantage and fail when they leave. Peer-to-peer can work for small co-op games but makes authority and cheating harder to handle. Your choice affects hosting cost, matchmaking and how you plan regions.

Netcode planning checklist

  1. Decide dedicated, listen or peer-to-peer hosting based on mode and fairness needs.
  2. Pick a tick rate target and budget server CPU and bandwidth against it.
  3. Write movement and weapon code so client and server share it.
  4. Implement prediction and reconciliation for the local player first.
  5. Tune the interpolation buffer against realistic jitter, not perfect LAN conditions.
  6. Implement lag compensation with a maximum rewind window.
  7. Decide how projectiles and movement abilities are predicted.
  8. Test with simulated latency, jitter and packet loss from the first networked prototype.
  9. Add network debugging overlays: ping, packet loss, corrections, server tick.
  10. Plan anti-cheat on top of server authority, not instead of it.

Common mistakes

The biggest mistake is building a single-player prototype and adding networking later. Gameplay code written without prediction in mind usually has to be rewritten. Another is testing only on local networks, where problems do not appear. Engines and most networking libraries include tools to simulate bad connections, so use them daily.

A third is trusting the client for convenience, for example letting it report hits to save time. That shortcut tends to become a cheating problem after launch. If your multiplayer shooter runs in the browser, transport choices add their own constraints, covered in multiplayer browser games: WebSockets, WebRTC and game servers.

When to bring in a studio

Netcode is the area where shooter experience pays off most, because problems surface late and are expensive to fix. If your team is strong on design and content but has not shipped a networked shooter, bringing in specialists early can save a rewrite. paxl.co can build the networking layer as part of a full project or as co-development alongside your team, and our FPS game development page explains how. You can also read Unreal vs Unity for FPS to see how each engine's built-in networking compares.

FAQ

Why do I get hit after I am already behind cover?

Lag compensation checks shots against where you were on the shooter's screen, which is slightly in the past. If they fired before you reached cover from their view, the server accepts the hit even though you had already moved on your own screen.

Is a higher tick rate always better?

Higher tick rates reduce some latency effects and improve accuracy, but they cost more server resources and bandwidth. Beyond a point, network latency and interpolation delay dominate. Choose a rate based on your game's pace and measure the results.

Can I add multiplayer to my single-player shooter later?

It is possible but usually expensive. Movement, weapons and game state need to be structured for prediction and server authority, which tends to mean rewriting much of the gameplay code. Decide on multiplayer before production starts.

Planning something like this?

See how paxl.co handles fps & 3d action games, or tell us about your project and we will reply within two working days.

Keep reading