Framerates Explained

Most veteran FPS players are familiar with a concept known as framerate capping or framerate limiting. In the context of FPS games, a frame refers to one redrawing of the screen, but this can be bound to other input/output (IO) operations such as polling the keyboard and mouse for events, submitting PCM output to a sound device, and reading from or writing to a network socket.

Older games, such as id Software's Quake II took a very straightforward approach towards framing: screen redrawing, and all other IO operations, would happen once per iteration of the "big client loop."[1] In 1997, when Quake II was released, the fastest computers struggled to crank out more than 60 frames per second (fps) at even modest resolutions like 800x600. Today, the cheapest laptop on the market is capable of over 100 frames per second at much higher resolutions, with powerful PCs cranking out over 500fps at resolutions as high as 1920x1200. This poses a serious problem for the traditional "big client loop" implementation: 500 network packets per second to the server will saturate all but the fastest connections -- for practically no benefit. The solution is to decouple the video/sound/key/mouse refreshes from network refreshes, so that the client can run these operations independently. The goal is to lower network packet rates as much as possible without adversely impacting gameplay. Bandwidth, after all, is a premium.

Let's talk about latency for a moment. Latency (commonly refered to as "ping" in Quake lingo) is the time it takes for a client to see their input commands (like pressing the fire button) reflected on their screen. At 60fps, an implicit average local latency of 0.0083s (8ms) exists for the time it takes to complete one iteration of the input loop. This is latency accrued before user input ever leaves the client as an input command. This number decreases as your framerate increases. For example, at 100fps, each frame executes in approximately 0.010s, yielding an average local latency of .0050s, or 5ms. As a quick test, load a level and play with cl_maxfps while watching your ping in the scoreboard. At higher values of cl_maxfps, your ping will decrease.[2]

So clearly, lowering network framerates will adversely impact latency of input events. To avoid this, good frame decoupling implementations use a flag to override the network framerate capping conditions in the presence of special input events like pressing the fire or jump buttons. In other words, a properly decoupled engine will always send your important commands as soon as possible. Quetoo and R1Q2 both offer this feature. Sounds good, right? Well..

To complicate matters more, Quake II and derived game servers calculate player movement physics each time an input command is received from the client -- a framerate-bound calculation. Measures were taken to apply fairness for all framerates, but because the math is floating point based, there are rounding issues which make some framerates advantageous over others. Players were rather quick to identify this shortcoming, and exploit it. This is why "magic" numbers like cl_maxfps 112 are still heavily used today. Without dramatically refactoring the server and game module, there is no way of completely avoiding this issue. Quake2World attempts to modify the game physics to minimize the impact of this undesirable behavior so that network framerates as low as 30pps are acceptable.

For legacy Quake II servers, provided your hardware and connection are capable, your best bet is to adjust your client to send at least 60 packets per second, but no more than 125.


[1] The "big client loop" refers to the main execution path of the engine's client code, e.g.

clientFrame(){

  readFromNetwork();

  paintScreen();

  playSound();

  readKeyboardAndMouse();

  writeToNetwork();
}

main(){
  while(true){

    serverFrame();

    clientFrame();
  }
}

[2] If you still don't buy into this concept, compare your ping when playing on your local listen server versus a dedicated server on your 100mbit LAN. Your ping will actually be lower to the dedicated server than to your own computer. Do you understand why?