How to make my game stop stuttering (fps drops) ?

I don’t use pixel perfect collisions
smooth image is disabled except for a couple of things
i have events that are just this one condition with over 10 actions with it (btw Do events make the game stutter ?)
i have so many resources in my game (around +120) and i’m planning to add even more .
(how to make the game feel smooth even if it has this many resources ?)

i’m making the game for ( android / IOS (if gdevelop 5 supports it) / windows )

Thanks for any help .

Are you sure the FPS is drop and it is not just a glitch with rendering?
How much the FPS drop exactly and when?

In general to optimize your performance, first thing you need to keep in mind is that every single condition is checked 60-30 times a second in GDevelop and you may want to avoid certain conditions checked that many times by putting them in to a sub-event and check something require less resources in the parent event because the sub-event going to fire only if the parent event was true.

For example, if you have buttons in your game the player need to press, first check if the mouse is pressed or touch is down and then in a sub-event check, if the mouse is over the sprite. This way you don’t waste resource on checking if the mouse is over the sprite when it is not necessary because the sub-event won’t fire.

An other example is collision checking. In case checking collision on something that is created and deleted dynamically in the game like bullets and enemies, you may want to consider to check if the number of sprites is > 0 and do collision checking on the sprites in a sub-event to avoid wasting resources on calculating collision even if the sprite doesn’t exist.
You may also want to consider to add a timer and limit the number of times / second you are checking collision, it helps to avoid slow down because of frequency of collision checking but from my experience it is not always help. If the collision checking on it own cause lag, regardless if you are checking 60 times or a single time / second, it will lag when the collision is checked.
You also want to avoid checking collision with too many objects at the same time and you may want to pick a random object and check collision with that single random object only. As this condition will repeat 30-60 times a second there is a very good chance by the end collision is going to be checked on all of your sprites but only 1 at the time instead of 30 which can increase performance.
Finally, avoid using pixel-perfect collision checking, never use it. Doesn’t worth it, in-fact from what I heard it is not even planned to be included in GD5 for that reason because it is a bad practice.

Optimization is a broad topic, you can find lot of very good and very long discussions about it if you search the forum.

Good Luck.

1 Like

It’s not fps drop more that just the level is loading … And when there is moving platforms /enemies the game just starts to sttuter .

So very good i don’t use pixel perfect collisions

But i don’t understand the meaning of checking the collision every 30 - 60 seconds

Do i have to put a timer (say 0.1 seconds) of every single collision in every single level ? And would that really help with loading the level and sttuter ?