Skip to content
Techniques & Technology

Client-Side Prediction

Making lag invisible

Client-side prediction lets a networked game act on the player's input before the server confirms it, then corrects the result when the answer arrives. Magazines in 1996-97 describe id Software introducing it in QuakeWorld, its PUSHLATENCY command, and the rubber-band corrections that came with it.

ibm-pcnetworkingmultiplayerquakelatency

Client-side prediction is a way of hiding network delay in an online action game. The player’s machine acts on an input at once, as though it already knew the server’s answer, and the server corrects it afterwards if the guess was wrong. The technique reached players in QuakeWorld, id Software’s rewrite of Quake’s network code, which magazines previewed in autumn 1996 and which was released free in mid-December that year.

Fast facts

  • Introduced in: QuakeWorld, described in October 1996 as John Carmack’s “pet project devoted exclusively to Internet play” (Computer Gaming World).
  • What it hid: the round trip to the server. C&VG called a 350 ms ping “just about acceptable” for the original game.
  • The player’s control: PUSHLATENCY -xxx, with “xxx” replaced by your ping (C&VG, March 1997).
  • The cost: rockets that fired “slightly late”, doors that opened “a bit later than you’d expect”, and the occasional larger correction.

Internet Quake before QuakeWorld

Quake shipped in 1996 with internet play, and the magazines that tried it agreed on the problem. Computer and Video Games explained the “ping” figure shown beside each player’s name as “the typical response time between you pressing a button, that command being sent to the central server and the response returning to your machine”, and reckoned 350 ms “just about acceptable”. Even UK servers, it said, could be “at least three times slower than playing a one-on-one link-up game”.

PC Gamer was blunter: unless you were lucky, “the best sort of game you could hope for was one with a lag time of under a couple of seconds (i.e. when you fired your gun, it actually fired on screen within a couple of seconds of your doing it).” Its explanation was that id had “based the Net code on their own network”, so it worked for anyone with a network connection and “for playing over anything less you’d end up sacrificing an awful lot in terms of playability.”

What Carmack was building

Computer Gaming World’s “Quake Aftershocks” column of October 1996 carried the clearest period description of the mechanism. Carmack had been “continually modifying QUAKE’s network code to improve Internet play”: smaller packets gave real gains, and “an increased flexibility in the way clients process ‘game states’” improved perceived performance. Then the part that matters:

As it was explained to me, the client will not need to wait for the server to respond to each request before processing the next move or action. This will allow for smoother play. It[’ll] feel about 100 milliseconds faster than the actual “ping time” would suggest. To compensate for Internet latency between server and client, the server will continuously synchronize with the client — think of the way a rubber band allows some stretch, but always tugs back. These corrections will generally be so seamless as to be unnoticeable, but the occasional “big one” may result in something like weapons fire erupting from nearby instead of from your gun barrel.

That is client-side prediction and its correction in one paragraph, and the rubber band image has stayed with the technique since. The same column said id planned “to fully integrate QuakeWorld into QUAKE 2”, with custom executables to bring some of it to the registered Quake in the meantime.

C&VG’s preview the same month promised that “the slow response from the net will be worked around meaning that the game should look and move just like the single-player game. There will still be some delay (noticeably when firing at opponents), but it will be tons better than it is at the moment.”

PUSHLATENCY

QuakeWorld exposed the prediction to the player as a console command. C&VG explained it in March 1997 under the heading “Completely lag-less!”:

With QuakeWorld, you can set the game to predict bits of information, rather than waiting to be told exactly what’s happening by typing “PUSHLATENCY -xxx”. Simply replace the “xxx” with your ping and you’ll immediately notice that control of your character has improved to be pretty much exactly the same as playing a one-player game! This prediction means that a few things are slightly out of place in the game, with rockets still firing slightly late, doors opening a bit later than you’d expect, and so on, but it makes the game much, much better to play overall.

By June the magazine had reduced it to a recipe: with a ping of 200, “just type PUSHLATENCY -200 and the game will predict what happens for that 200ms!” — which “gives you much better control over your character”.

The magazines did not agree on what was being predicted. CGW and C&VG describe the client acting on the player’s own input without waiting; PC Gamer described PUSHLATENCY as “a Quake equivalent of Mystic Meg”, compensating for lag “by predicting where all the other players should be”, and warned that other players would “appear to teleport from one place to another as your PC puts them back on the right track”. Both accounts describe the same visible correction from different ends.

Release

PC Gamer records that id, having “quickly realised their mistake”, worked on the internet code, added skins and Capture the Flag, adopted the QSpy server browser as a Windows 95 front end, and “finally in mid-December launched QuakeWorld as an unsupported product. It’s free, but if you run into problems, don’t go crying to Id.” The first releases tied prediction to a master server that registered and ranked every player; C&VG reported in June 1997 that version 1.55 dropped the registration and ranking, keeping PUSHLATENCY, “now even better at predicting than before”.

See also

Not yet fact-checked. This entry was drafted by an AI and nobody has verified it. The dates, figures and technical details may be wrong. Use it to find your bearings, then confirm anything that matters against a primary source.