0 Members and 4 Guests are viewing this topic.
var fpsStep = 1000 / maxFPS; fpsTimePassed = 0; fpsLastTime = 0;begin fpsTimePassed := fpsTimePassed + timeGetTime() + fpsLastTime; fpsLastTime := timeGetTime(); if (fpsTimePassed >= fpsStep) then begin RenderFrame; fpsTimePassed := fpsTimePassed - fpsStep; end;end;
It still gives the exact same result Neosano, 200+ fps.and timeGetTime() = http://msdn.microsoft.com/en-us/library/dd757629%28VS.85%29.aspxAt the moment I've got a better method, but still seems a tiny bit off. Capped at 75, getting 74-77 FPS, when capped at 120 getting 119-122. According to FRAPS.
Ok, when I do that it sits at 76-77 with a 75 cap; however at 120 cap it sits at 125 very steadily. 168 @ 160. 63 @ 60@Major, yeah I agree its the decimal thing now. And RenderGame only renders the screen, all the time related events are outside the cap code.
Btw, Try 100 fps. maybe the problem is in dividing?
var maxFPS: byte = 0; fpsLastFrame: DWORD = 0; fpsCurrentTime: DWORD = 0; fpsRenderInterval: WORD = 0; // calculate render interval time after you read maxFPS value from .ini or smthfpsRenderInterval := Round(1000 / maxFPS);begin fpsCurrentTime := timeGetTime(); if (fpsCurrentTime - fpsLastFrame) >= fpsRenderInterval then begin RenderFrame; fpsLastFrame := fpsCurrentTime; end; end;
still~the fps capping shouldn't only cap the drawed fps, but also all the processed data.
http://dev.koonsolo.com/7/dewitters-gameloop/I think that Soldat already follow "Constant Game Speed with Maximum FPS" concept and cant be changed easier as like coding some lines.
Quote from: Neosano on May 31, 2010, 10:04:43 amBtw, Try 100 fps. maybe the problem is in dividing?100 sits perfectly at 100. So yes, it is something wrong with the dividing now.
Um.fpsStep mustn't be an integer or byte.. something float is needed here.same goes for fpsTimePassed.
Quote from: Neosano on June 01, 2010, 06:21:25 amUm.fpsStep mustn't be an integer or byte.. something float is needed here.same goes for fpsTimePassed.timeGetTime returns an integer value (DWORD type), so... you are wrong.