[Question] Lag is causing platformer characters to fall through the level

Hello Everyone,

I’ve been encountering an issue on some of my platformer projects where characters and objects are falling through the map whenever there is a spike in lag.

Here is a video of it occurring with the built-in platformer project:

I checked my older platformer projects and this issue will occur when a spike in lag happens. I can get it to happen reliably by spamming ‘print screen’. Usually my levels are simple enough where this is not an issue. However, with some of my games, this has become unplayable for certain users:



I’ve tried a variety of different things but cannot manage to get this working properly. As best I can tell, when a spike in lag is occurring the usual collision code isn’t being checked but the update function is still running, which results in ‘ground contact’ being false and thus the player falls through the map.

Is there a setting within the game engine that I have missed? Is there something I should be doing differently with the platformer code to ensure the character isn’t falling through the map?

Any advice for how I can fix this would be welcome.

Thank you!

I would start by trying out a fixed physics update and see if that helps. It should as you are guaranteed to get stable updates of physics: Physics in Defold

1 Like

Thank you! After switching the code to use fixed_update and enabling it within the engine, the problem has disappeared. I have re-uploaded my older projects that didn’t contain that code.

Thanks again!

2 Likes