When using a fixed framerate, I have noticed that the game will speed up dramatically after experiencing lag.
Here’s a video example of what I’m talking about.
A quick note that in the video, the music and the projectiles spawning are being triggered by timelines and NOT on tick. The projectiles are using a projectile movement component.
Here’s what the “stat engine” looks like while the game is running normally.
…And here’s what it looks like when the game has decided to speed itself up.
Notice that the FrameTime has gone down to almost match the GameEngine Tick when the game has sped itself up.
So from what I gather, the game is creating a backlog of frames for processing during the lag. When the lag ends, the game decides to process the frame backlog as fast as possible. Because the Delta Time between frames is constant (due to the fixed framerate), the increased FPS causes a speed up relative to real time.
So here’s my question. Is this a bug? And if not, how can I stop my game from speeding up after lag?
I am fine with having slowdown when the game cant keep up, but I absolutely can not have the game playing back at an unbounded rate afterwards. If I get slowdown, I would like for the game to nicely return to my fixed framerate when it can instead of trying to catch up by running several times faster.