Menu

#37 Configurable FPS Limit

Next_Release
open
nobody
None
5
2021-03-05
2017-03-22
Korvox
No

HoT still has the magic number 72 fps limit. I recently got a fancy 144hz monitor, so I changed it in host.c, rebuilt and the game works fine (so far, haven't tried netplay with it yet). Is there any major blocking reason why HoT doesn't have a cvar such as cl_maxfps like other Quake source ports to tweak the fps limit?

I could really easily make a patch to add that cvar if you guys want, though I feel like I'm missing something major as to why HoT still has the constant fps limit.

Discussion

  • Eric Wasylishen

    Eric Wasylishen - 2017-08-15

    In Quake physics break above 72hz (e.g. riding on elevators can damage the player, walking up slopes has issues). it's possible but not easy to decouple the server and client framerate. I haven't checked uhexen2 but this will most likely be the same problem.
    some discussions focused on Quake:
    http://forums.insideqc.com/viewtopic.php?f=3&t=4786
    http://forums.insideqc.com/viewtopic.php?t=3308

     
  • Korvox

    Korvox - 2017-08-15

    I figure showing is better than telling, so here is me running around HoT with the framerate limit removed (it is instead capped to the monitors refresh rate, in my case 144, and its showing around 130-135).

    I can't find any physics / jumping breakages. I have not done a diff between HoT and the original H2 source to try to find what changed, but it seems whatever functionality eventually landed in projects like Quakespasm / Darkplaces that decoupled the framerate from physics is already in HoT.

    I couldn't think of an easy to access elevator besides the one at the end of Episode 3 though. Are here any near the start of a level I can warp to to see if it causes any problems?

     

    Last edit: Korvox 2017-08-15
  • Feels Ranger Man

    I accomplished this by adding a 'host_maxfps' c_var to host.c:

    patch:

    --- host.c  2021-03-06 11:24:17.499268500 -0600
    +++ host_new.c  2021-03-06 11:35:20.810182400 -0600
    @@ -76,7 +76,7 @@
     cvar_t noexit = {"noexit", "0", CVAR_NOTIFY|CVAR_SERVERINFO};
    
     cvar_t developer = {"developer", "0", CVAR_ARCHIVE};
    -
    +cvar_t host_maxfps = { "host_maxfps", "72", CVAR_ARCHIVE };
     cvar_t skill = {"skill", "1", CVAR_NONE};      // 0 - 3
     cvar_t coop = {"coop", "0", CVAR_NONE};        // 0 or 1
     cvar_t deathmatch = {"deathmatch", "0", CVAR_NONE};    // 0, 1, or 2
    @@ -363,7 +363,8 @@
            Cvar_Set ("developer", "1");
            Cvar_LockVar ("developer");
        }
    -
    +   
    +   Cvar_RegisterVariable (&host_maxfps);
        Cvar_RegisterVariable (&sys_nostdout);
        Cvar_RegisterVariable (&sys_throttle);
    
    @@ -668,7 +669,7 @@
     {
        realtime += time;
    
    -   if (!cls.timedemo && realtime - oldrealtime < 1.0/72.0)
    +   if (!cls.timedemo && realtime - oldrealtime < 1.0/host_maxfps.value)
            return false;       // framerate is too high
    
        host_frametime = realtime - oldrealtime;
    @@ -756,7 +757,7 @@
        SV_CheckForNewClients ();
    
        temp_host_frametime = save_host_frametime = host_frametime;
    -   while (temp_host_frametime > (1.0/72.0))
    +   while (temp_host_frametime > (1.0/host_maxfps.value))
        {
            if (temp_host_frametime > 0.05)
                host_frametime = 0.05;
    

    host.c with above changes made:

    https://pastebin.com/ZknGeBFg

    Now you can change the maxfps on the fly via the console like quake by setting host_maxfps to whatever you desire.

     

    Last edit: Feels Ranger Man 2021-03-06

Log in to post a comment.