Server rate limit

From ioquake3 wiki
Revision as of 17:41, 15 December 2007 by TimeDoctor (talk | contribs) (1 revision(s))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

When running as a dedicated server, it would be wasteful of CPU resources to let the main loop repeatedly call Com_Frame() as fast as it can, since a dedicated server does not perform nearly as much computation per frame as a client does. When running as a dedicated server, therefore, there are rate-limiting pauses, depending on the platform:

Unix

On Unix, each frame is delayed using NET_Sleep(), which is called by SV_Frame(). It blocks for network activity or a timeout period before returning.

Windows

On Windows, NET_Sleep() is not implemented, but there is a 5 msec delay in the main loop in WinMain() when running as a dedicated server. This delay effectively caps the FPS at 200 and prevents the main loop from going into a tight spin and consuming all CPU resources.