Hi there, the most common way to implement game loop around internet is
const int FPS = 25;
const int FrameDuration = 1000 / FPS;
const int MaxFrameSkip = 5;
long nextFrameTime = time();
float interpolation;
int loops;
while( isGameRunning )
{
loops = 0;
while( time() > nextFrameTime && loops < MaxFrameSkip )
{
updateGameState();
nextFrameTime += FrameDuration;
loops++;
}
interpolation = .....;
render(interpolation);
}
The author says that updateGameState() calls 25 times per second, now less, no more. In my mind this mean that while should run 25 times. Am i wrong? According to loops variable there is restriction on 5 runs. So how there can be 25 times per second?
And if this mean, that user input catch inside updateGameState also 25 times\sec?