Anyway, I need the server game loop to fire at 30 frames per second. 1 divided by 30 being about every 33 milliseconds I need the game loop to fire.
So simple enough it should look like this:
- Code: Select all
AddTimer(GameLoop, 33);
However, the GameLoop function is being called a fairly significant bit slower than the intended 33 fps.
So I ran a simple test, incrementing a counter every time the GameLoop fires, for 60 seconds.
Ideally, my result for the counter at the end of the 60 seconds should be about 1818. (60,000 / 33 = 1,818)
However the counter was much lower, being around 1336 at the end of the 60 seconds. (around 26% slower!)
Setting the timer intervals to 32 instead of 33 gave me around 1,406.
27 gave around 1,696.
26 gave around 1,836.
So I'm not sure what to do here. Is this a bug? Why is it so far off? Should I just set the intervals to 26 instead of 33 since the result was closer to my intended target? This test was ran on the development server. Once uploaded to the main server, will this still behave the same?
Thanks!