Dragonfly Q&A

Ridiculous speedups mid-game?

0 like 0 dislike

As I was testing my game, I noticed that the game seemed to speed up to ridiculous levels for no discernible reason. It was as if the game loop lost its 30 fps maximum mid-game. This has happened to my partner as well. This can't truly be the case, though, right? Is there anything that could cause the game loop to speed up to such levels? This doesn't cause a huge issue in using the computer's resources, as my partner and I have made sure to clean up any memory leaks in our game, though this phenomenon results in the game being incredibly difficult, as enemies can move much faster than the player can react. Thanks.
asked Oct 11, 2014 by cgporell

1 Answer

0 like 0 dislike
Very odd.  Seems unlikely (but not impossible) that this is from game code.  Rather, it sounds like the engine is not sleeping in the game loop, but is instead proceeding as fast as possible.  Are you using my version of Dragonfly or your own? This was a known bug that was fixed in v2.9, but perhaps it is a different manifestation (timing bugs are sometimes difficult to reproduce and produce unit tests for).  Do you have a set of cases that reproduces it consistently?  If so, please indicate how/what and zip up your code and send it to the staff list.  Also, indicate what platform you are running/developing on.
answered Oct 13, 2014 by claypool
I'm running the game on Cygwin in Windows 7. My partner has had this issue only once or twice (he's also running Cygwin on Win7). We're using his version of the engine, and he checked his game loop and verified that the code for engine sleeping is working fine. I haven't been able to replicate it yet, as the cause doesn't seem to be a particular event from what I've seen so far.
Did his engine implement " Fine Tuning the Game Loop" or something similar?  If so, you need to be careful to make sure that after an adjustment to the sleep time (correcting a previous loop iteration), the adjustment time is zero-ed out.  Not doing this will result in a 0 sleep time perpetually in some cases.
More information about Dragonfly can be found on the Dragonfly Home Page.