A short quick tutorial to add a frame rate limiter cvar to the Quake
engine. Some of the uses for this are for netplay, the less frames
being rendered the less updates needed to be sent to the server. It
also allows you to play Quake at whatever framerate your GFX card can
reach, not limited by Quake's default maximum of 72fps.
Now for the code. At the top of host.c add the following line: cvar_t max_fps = {"max_fps", "72", true}; // MrG - max_fps Now in the function Host_InitLocal, add the following line above the other calls to Cvar_RegisterVariable: Cvar_RegisterVariable (&max_fps); // MrG - max_fps Now locate the function Host_FilterTime, and replace: if (!cls.timedemo && realtime - oldrealtime < 1.0/72.0) // MrG - max_fps if (max_fps.value < 1) Cvar_SetValue("max_fps", 72); if (!cls.timedemo && realtime - oldrealtime < 1.0/max_fps.value) Have fun playing Quake at several hundred FPS! |