|This article needs additional citations for verification. (February 2008)|
Client-side prediction is a network programming technique used in video games intended to conceal negative effects of high latency connections. The technique attempts to make the player's input feel more instantaneous while governing the player's actions on a remote server.
The process of client-side prediction refers to having the client locally react to user input before the server has acknowledged the input and updated the game state. So, instead of the client only sending control input to the server and waiting for an updated game state in return, the client also, in parallel with this, predicts the game state locally, and gives the user feedback without awaiting an updated game state from the server.
Client-side prediction reduces latency problems, since there no longer will be a delay between input and client-side visual feedback due to network ping times. However, it also introduces a desynchronization of the client and server game states, which needs to be handled to keep the game playable. Usually, the desync is corrected when the client receives the updated game state, but as instantaneous correction would lead to "snapping", there are usually some "smoothing" algorithms involved. For example, one common smoothing algorithm would be to check each visible object's client-side location to see if it is within some error epsilon of its server-side location. If not, the client-side's information is updated to the server-side directly (snapped because of too much desynchronization). However, if the client-side location is not too far, a new position between the client-side and server-side is interpolated; this position is set to be within some small step delta from the client-side location, which is generally judged to be "small enough" to be unobtrusive to the user.
The earliest first-person shooter to use this technique was Duke Nukem 3D, released in January 1996. Later that year, it was implemented in QuakeWorld, the popular add-on to Quake. While network play was included in the original Quake game, it was optimized mainly for LAN play. Having all had high-speed home connections (a rarity at the time), Quake's designers overlooked their assumptions of high bandwidth and low ping times that made playing online frustrating for dial-up users. After a series of experiments in a long private beta, id Software released QuakeWorld with a new predictive model that proved popular with both high and low latency players.
- Bernier, Yahn W. (2001). "Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization" (PDF). Retrieved 2008-12-19.