Continuing on my Networking Demystified series, I discuss the basics of how client-side prediction and server reconciliation work to create responsive, well synced gameplay. This article will briefly touch on several of the topics of my previous Networking Demystified articles.

Client-side prediction is essentially the act of the player providing inputs and simulating forward without waiting for the server to receive those inputs: immediate action and immediate response.

Reconciliation is the act of reconciling the results of those inputs with what the server believes the results should be. Reconciliation can be done in a variety of ways. A common way of allowing reconciliation is through snapshot interpolation. Snapshot interpolation provides players with periodic game state snapshots from the server, and the players can then lerp from their predicted state through any ensuing snapshots and towards the latest server snapshot. In this way smooth eventual synchronization is guaranteed, but the client is almost always slightly desynchronized from the server. This usually necessitates the use of lag compensation to ensure proper hit registration.

Lag compensation, explained simply, is the process of the server looking back in time to the point where the player performed an action and using that to decide if the action is valid or not rather than taking the action as if it happened in the current server time. The most common use case for lag compensation is in FPS games to determine whether or not a player shot another player when they said they did. Without lag compensation the server would be forced to either just trust the player or to deny the existence of a hit at all (for a more in-depth explanation see my previous article: Multiplayer Lag Compensation Demystified).

Client-side prediction is a key part of adding many types of networked features to Unreal Engine and Unity using most networking stacks, and you’ll often need to implement some form of it in order for your custom systems to feel responsive. Thanks for reading, and let me know in the comments if you have any questions or need clarification on any parts.