1
General / Re: High FPS unstable frametimes?
« on: October 21, 2015, 08:36:15 pm »Also something else to consider why you need a limit: Assume your target update rate is 100 updates per second. What happens if the machine is too slow and is only able to update 90 times per second? It will never ever leave that loop again, because you'll constantly add outstanding updates.Actually it would account for running too slow, as it adds the time taken since the last update, and subtracts every time it actually updates the game itself. So if it was too slow, it would skip cycles until it accumulated enough time to calculate another game "frame". It would just result in stutters actually quite similar to the ones that I get currently. That was my first thought as far as my issue goes; but the problem is reproducible at any poll rate of the game frames. I think Gaffer's article refers to it as "fixed update time step, variable rendering". Variable t produced by the renderer, consumed by the updates in fixed dt increments.
That being said, I realized that my measuring of time could be flawed. I measure currently in microseconds, and I tried comparing sf::Time objects, but couldn't determine any way without converting to concrete types at some point in the process.
That's completely normal, however you might want to limit the amount of frames caught up. Otherwise the game will run for several seconds (or even longer) without the user being able to react properly, once the window got moved (or something else happened). This might most likely be at least part of your issue here.This did get me thinking though, wouldn't just skipping amounts of lost frames affect the determinism of my game in the long run? Perhaps that's the least of my problems at the moment, but I am concerned that if I commit now, it might eliminate possibilities of any game features that rely on determinism (replays, multiplayer, etc). Maybe just log whenever frames are lost? Perhaps I just cross that bridge when I come to it...