Server rate limit

From ioquake3 wiki
Jump to navigation Jump to search

When running as a dedicated server, it would be wasteful of CPU resources to let the main loop repeatedly call {{#ifexist:Com_Frame|Com_Frame()|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 {{#ifexist:NET_Sleep|NET_Sleep()|NET_Sleep()}}, which is called by {{#ifexist:SV_Frame|SV_Frame()|SV_Frame()}}. It blocks for network activity or a timeout period before returning.

Windows

On Windows, {{#ifexist:NET_Sleep|NET_Sleep()|NET_Sleep()}} is not implemented, but there is a 5 msec delay in the main loop in {{#ifexist:WinMain|WinMain()|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.