Frame Skipping - Weird Results

For questions about using Classic.

Post » Wed Oct 31, 2012 11:16 am

I've set my application at 60FPS V-synced (also tried fixed). Whenever the CPU gets momentarily busy with other activities, the game's framerate drops, but the game seems to keep processing invisibly and misses all the frames that werent rendered to screen. Eg, if the character is falling and just before he is about to hit the ground, the game hitches for 0.5 seconds, by the time it resumes, he has fallen way past the ground and the collision detection that should have stopped him on the platform while the game was frozen never takes place. This is just one example of the issue but it happens in other cases as well.

Any ideas how to prevent something like this happening?

An almost certain way for me to reproduce the error is to use FRAPS to record a video of the game while playing it. From time to time, it hitches, and weird sh*t happens.djsubtronic2012-10-31 11:16:45
Posts: 20
Reputation: 340

Post » Wed Oct 31, 2012 5:57 pm

Objects using delta time, like behaviors, can do things like "jump" through walls when the framerate stalls, because movement is basically a series of teleports that happens every frame. If the framerate gets too low, as delta time results in pixels per second moved, the gaps between "teleport locations" can jump entirely over obstacles, meaning the collision detection doesn't catch them.

The easiest solution to this is to set a minimum (or maximum, I can't remember how it's labeled at the moment) dt in the project properties (I think it's under some advanced section). Set it to something no higher than 0.1, and if the framerate stalls lower than 10 fps, the gameplay will slow as well, preventing the player from jumping through obstacles.
Posts: 3,002
Reputation: 27,241

Post » Wed Oct 31, 2012 7:22 pm

There's a timer FPS setting at 100 FPS, override timer which is disabled, and minimum FPS setting which was set to 0. I've set that to 40, so I think now the game slows down if the FPS drops below 40. Think that's resolved the issue. Thanks Arima :)
Posts: 20
Reputation: 340

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests