Client-side prediction is a
network programming technique used in
video game
Video games, also known as computer games, are electronic games that involves interaction with a user interface or input device such as a joystick, controller, keyboard, or motion sensing device to generate visual feedback. This fee ...
s 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
Server may refer to:
Computing
*Server (computing), a computer program or a device that provides functionality for other programs or devices, called clients
Role
* Waiting staff, those who work at a restaurant or a bar attending customers and su ...
.
The process of client-side prediction refers to having the
client
Client(s) or The Client may refer to:
* Client (business)
* Client (computing), hardware or software that accesses a remote service on another computer
* Customer or client, a recipient of goods or services in return for monetary or other valuabl ...
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 unintrusive to the user.
Another solution to the desynchronization issue, commonly used in conjunction with client-side prediction, is called ''server reconciliation''. The client includes a sequence number in every input sent to the server, and keeps a local copy. When the server sends an authoritative update to a client, it includes the sequence number of the last processed input for that client. The client accepts the new state, and reapplies the inputs not yet processed by the server, completely eliminating visible desynchronization issues in most cases.
The earliest known first-person shooter to use client-side prediction is
Duke Nukem 3D
''Duke Nukem 3D'' is a first-person shooter video game developed by 3D Realms. It is a sequel to the platform games ''Duke Nukem'' and ''Duke Nukem II'', published by 3D Realms.
''Duke Nukem 3D'' features the adventures of the titular Duke Nuke ...
, which had it built-in since the January 29, 1996 shareware release. The technique was also a prominent feature of ''
QuakeWorld
''Quake'' is a first-person shooter game developed by id Software and published by GT Interactive. The first game in the Quake (series), ''Quake'' series, it was originally released for MS-DOS, Microsoft Windows and Linux in 1996, followed by ...
'', the popular add-on to ''
Quake''. While network play was included in the original ''Quake'' game, it was optimized mainly for
LAN play. Having had high-speed home connections (a rarity at the time), ''Quakes designers overlooked their assumptions of high bandwidth and low ping times that made playing online frustrating for
dial-up
Dial-up Internet access is a form of Internet access that uses the facilities of the public switched telephone network (PSTN) to establish a connection to an Internet service provider (ISP) by dialing a telephone number on a conventional telepho ...
users.
[John Carmack]
QuakeWorld .plan
/ref> After a series of experiments in a long private beta, id Software
id Software LLC () is an American video game developer based in Richardson, Texas. It was founded on February 1, 1991, by four members of the computer company Softdisk: programmers John Carmack and John Romero, game designer Tom Hall, and ar ...
released ''QuakeWorld'' with a new predictive model that proved popular with both high and low latency players.
See also
* Lag (online gaming)
References
{{Reflist
Video game development