It can be used tricks with Game.CurrentTime instead of Sleep().
On of the examples of using:
while (something)
{
if (Game.
CurrentTime - CurTime <
16) //if not expired 16 ms (for 60 fps) - do nothing {
}
else
{
...
}
}
Real time of iteration executing with Sleep() consists of time to run all commands in iteration (that always processor-dependent and different on varrious CPU's) and time of Sleep() (which can be considered as processor-independent). So iteration time with using Sleep() always various and definitely more than time of Sleep().
And in the above example time of iteration always is no less (but may be more), than the necessary 16 ms, so fps will be no more than 60. You can use it in render-specific places and in the main loop if necessary. Thus even game engine will give more than 60 fps, all calculations, inputs, loops etc will work at no more than 60 fps and approximately equal on all systems.
Is there a way to force the game to run at 60 frames per second on every PC ? Trying to get a game to work with the same Sleep(); times for different performance PC's. Thanks