Gamestate Extrapolation

From AQ2World Wiki
Jump to navigation Jump to search

Technical explanation

Problem

In AQ2, servers run in sv_fps 10. This means that even though the game is running at a high fps for you, the server is only updating ten times a second; you get updates from the server every 100 milliseconds.

Since you are only getting updates ten times a second, your client needs to smooth out the experience. If it didn't do this, your game would run in 10 fps. You can try this out with the console command cl_nolerp 1. Playing in 10 FPS is obviously not acceptable though, and every game in existence (including all quake clients ever) interpolates between these states so the game feels smooth. The problem with this interpolation is it adds extra 100ms of network latency even if you have 0 ping.

Gamestate Extrapolation

Gamestate extrapolation (called xerp in short) is an alternate way of your client smoothing out the 10 FPS experience. You can enable it with cl_xerp 1 (AQtion client) or cvarsync cl_xerp 1 (older clients, need to do this on every map load).

In multiplayer games, you can sometimes use extrapolation instead of interpolation to smooth out the game inbetween game states. For example, in a racing game, you can easily extrapolate from previous values in which direction other people's cars are going to move. You don't need to do interpolation between the last X amount of gamestates, you just look at where the car is moving and keep moving it in that direction.

The way it works is as soon as you get a message from the server about other player's locations, your client will show you THAT version of the game, not the one 100ms in the past. And then, for the next 100ms, it just continues, more or less, moving the enemy players in the direction they were going. This makes the game less delayed, but it can loko a bit weird, i.e. sometimes people will move in weird ways on your screen as updates to the game show up.

This has the effect of not having to lead (as much) on enemy players movement, i.e. you can shoot straight at enemies way more often.