1000 Frames per second (FPS)
#46
void limitfps(int &millis, int curmillis)
683    {
684        if(!maxfps) return;
685        static int fpserror = 0;
686        int delay = 1000/maxfps - (millis-curmillis);
687        if(delay < 0) fpserror = 0;
688        else
689        {
690            fpserror += 1000%maxfps;
691            if(fpserror >= maxfps)
692            {
693                ++delay;
694                fpserror -= maxfps;
695            }
696            if(delay > 0)
697            {
698                SDL_Delay(delay);
699                millis += delay;
700            }
701        }

...


1222        for(;;)
1223        {
1224            static int frames = 0;
1225            static float fps = 10.0f;
1226            int millis = SDL_GetTicks() - clockrealbase;
1227            if(clockfix) millis = int(millis*(double(clockerror)/1000000));
1228            millis += clockvirtbase;
1229            if(millis<totalmillis) millis = totalmillis;
1230            limitfps(millis, totalmillis);
1231            int elapsed = millis-totalmillis;
1232            if(multiplayer(false)) curtime = elapsed;
1233            else
1234            {
1235                static int timeerr = 0;
1236                int scaledtime = elapsed*gamespeed + timeerr;
1237                curtime = scaledtime/100;
1238                timeerr = scaledtime%100;
1239                if(nextmillis && watchingdemo)
1240                {
1241                    curtime += nextmillis;
1242                    nextmillis = 0;
1243                }
1244                if(paused) curtime = 0;
1245            }
1246            lastmillis += curtime;
1247            totalmillis = millis;
1248    
1249            checkinput();
1250    
1251            if(lastmillis) updateworld(curtime, lastmillis);
1252    
1253            if(needsautoscreenshot) showscores(true);
1254    
1255            serverslice(0);
1256    
1257            if(elapsed) fps = (1000.0f/elapsed+fps*10)/11; // avoid DIV-by-0
1258            frames++;
1259    
1260            audiomgr.updateaudio();
1261    
1262            computeraytable(camera1->o.x, camera1->o.y, dynfov());
1263            if(frames>3 && !minimized)
1264            {
1265                gl_drawframe(screen->w, screen->h, fps<lowfps ? fps/lowfps : (fps>highfps ? fps/highfps : 1.0f), fps);
1266                if(frames>4) SDL_GL_SwapBuffers();
1267            }
1268    
1269            if(needsautoscreenshot) makeautoscreenshot();
1270    
1271    #ifdef _DEBUG
1272            if(millis>lastflush+60000) { fflush(stdout); lastflush = millis; }
1273    #endif
1274            if (direct_connect)
1275            {
1276                direct_connect = false;
1277                connectserv(servername, serverport, password);
1278            }
1279        }

This was taken from main.cpp. Essentially, all that having a high framerate means is that there is very little delay each time it goes through a certain point in the main method. I'm not incredibly familiar with c++ so I can't really explain this that well but this is basically like having some sort of script wait a second before it continues. The actual framerate for the video is most likely around 60 despite it saying 1000 since most monitors refresh at a rate of around 60 hertz. This is also the reason why there are certain bugs when playing with very low framerates since the system clock does not stop (remember in 1.0.2 how smg would shoot at a lower rate with low fps?). For things like physics, I have not looked at the code, but I'm pretty sure it's based off of the system clock since you can't walk through walls at 1 fps.
Thanks given by:


Messages In This Thread
1000 Frames per second (FPS) - by Sheva - 11 Sep 11, 05:51AM
RE: 1000 Frames per second (FPS) - by V-Man - 11 Sep 11, 06:11AM
RE: 1000 Frames per second (FPS) - by Lantry - 11 Sep 11, 06:24AM
RE: 1000 Frames per second (FPS) - by V-Man - 11 Sep 11, 06:36AM
RE: 1000 Frames per second (FPS) - by Harrek - 11 Sep 11, 08:53AM
RE: 1000 Frames per second (FPS) - by Sheva - 11 Sep 11, 05:44PM
RE: 1000 Frames per second (FPS) - by Frogulis - 11 Sep 11, 10:50AM
RE: 1000 Frames per second (FPS) - by Cap0ne - 11 Sep 11, 11:01AM
RE: 1000 Frames per second (FPS) - by Cap0ne - 11 Sep 11, 03:34PM
RE: 1000 Frames per second (FPS) - by Lantry - 11 Sep 11, 04:50PM
RE: 1000 Frames per second (FPS) - by Andrez - 11 Sep 11, 05:21PM
RE: 1000 Frames per second (FPS) - by Lantry - 11 Sep 11, 05:31PM
RE: 1000 Frames per second (FPS) - by Luc@s - 11 Sep 11, 05:56PM
RE: 1000 Frames per second (FPS) - by Sheva - 11 Sep 11, 06:20PM
RE: 1000 Frames per second (FPS) - by samsattF - 11 Sep 11, 07:03PM
RE: 1000 Frames per second (FPS) - by V-Man - 11 Sep 11, 10:09PM
RE: 1000 Frames per second (FPS) - by Duckett - 12 Sep 11, 01:45AM
RE: 1000 Frames per second (FPS) - by Syntax - 12 Sep 11, 08:03AM
RE: 1000 Frames per second (FPS) - by titiPT - 12 Sep 11, 11:29AM
RE: 1000 Frames per second (FPS) - by Cap0ne - 12 Sep 11, 02:32PM
RE: 1000 Frames per second (FPS) - by bballn45 - 12 Sep 11, 02:58PM
RE: 1000 Frames per second (FPS) - by Viper - 27 Sep 11, 04:57AM
RE: 1000 Frames per second (FPS) - by TG|OwnedToast - 12 Sep 11, 03:40PM
RE: 1000 Frames per second (FPS) - by titiPT - 12 Sep 11, 03:55PM
RE: 1000 Frames per second (FPS) - by V-Man - 12 Sep 11, 05:04PM
RE: 1000 Frames per second (FPS) - by jamz - 12 Sep 11, 05:39PM
RE: 1000 Frames per second (FPS) - by TG|OwnedToast - 12 Sep 11, 04:26PM
RE: 1000 Frames per second (FPS) - by samsattF - 12 Sep 11, 06:48PM
RE: 1000 Frames per second (FPS) - by V-Man - 12 Sep 11, 09:05PM
RE: 1000 Frames per second (FPS) - by ExodusS - 12 Sep 11, 08:16PM
RE: 1000 Frames per second (FPS) - by Sanzo'' - 14 Sep 11, 05:53PM
RE: 1000 Frames per second (FPS) - by V-Man - 17 Sep 11, 09:18AM
RE: 1000 Frames per second (FPS) - by CoxA* - 17 Sep 11, 07:49PM
RE: 1000 Frames per second (FPS) - by macm - 20 Sep 11, 12:35AM
RE: 1000 Frames per second (FPS) - by Lantry - 26 Sep 11, 11:44PM
RE: 1000 Frames per second (FPS) - by Habluka - 27 Sep 11, 01:34AM
RE: 1000 Frames per second (FPS) - by makkE - 30 Sep 11, 11:36AM
RE: 1000 Frames per second (FPS) - by V-Man - 25 Oct 11, 10:03AM
RE: 1000 Frames per second (FPS) - by ElCrema - 27 Oct 11, 01:04PM
RE: 1000 Frames per second (FPS) - by makkE - 27 Oct 11, 02:02PM
RE: 1000 Frames per second (FPS) - by ElCrema - 27 Oct 11, 04:17PM
RE: 1000 Frames per second (FPS) - by Aight - 27 Oct 11, 05:04PM
RE: 1000 Frames per second (FPS) - by makkE - 27 Oct 11, 07:42PM
RE: 1000 Frames per second (FPS) - by ExodusS - 08 Nov 11, 12:04PM
RE: 1000 Frames per second (FPS) - by makkE - 08 Nov 11, 07:52PM
RE: 1000 Frames per second (FPS) - by ExodusS - 09 Nov 11, 01:37PM
RE: 1000 Frames per second (FPS) - by Vermi - 09 Nov 11, 02:03PM
RE: 1000 Frames per second (FPS) - by VenteX - 02 Nov 11, 05:39PM
RE: 1000 Frames per second (FPS) - by V-Man - 07 Nov 11, 08:06PM
RE: 1000 Frames per second (FPS) - by V-Man - 08 Nov 11, 07:17PM
RE: 1000 Frames per second (FPS) - by ExodusS - 10 Nov 11, 07:00PM
RE: 1000 Frames per second (FPS) - by Xenon - 10 Nov 11, 12:51PM
RE: 1000 Frames per second (FPS) - by Vanquish - 01 Jan 12, 10:26PM