Game performance in mobile

Hi guys!
Today I have a question about game performance.
With how many scenarios does the game begin to lose performance?
How many objects does the game lose performance?
What procedures affect game performance in gdevelop?

Thanks, sinha <3

Very complex topic, and there is no proper answer, there’re many factors to take into account.

But some general aspects:

  • The number of scenes doesn’t matter, only one scene lives at a time so others don’t affect the performance (CPU or RAM).
  • What matters is the number of paused scenes, when you pause a scene it is saved in the memory so you can get back at some point. Lot of paused scenes means the game will use more RAM. But only the current scene events run, so the CPU is unaffected.
  • The number of objects will affect the performance, for sure, at least a bit. But each object will affect the performance more than others, sprites compute animation playing every frame, for example.
  • When you talk about objects you have to take into account their behaviors, it isn’t the same 100 sprites with a draggable behavior than 100 sprites with platformer or physics behaviors, complex ones that must do some calculations every frame.
  • Finally events, you can have 1000 sprites around happily and run at 60 FPS, now add the condition “Sprite collides with Sprite” and get ready for your FPS to drop down.

So the number of scenes doesn’t matter, but the number of objects may be important, taking into account their type, behaviors, and events related :slight_smile:

1 Like

Maybe I remember wrong but I thought exactly to avoid people using up all their RAM by pausing lot of scenes, GD allow to pause only 1 scene at the time. If you move on to another scene and pause the current one, if you had a paused scene before that, it is going to be erased from memory. Only the most recently paused scene stored in memory. Or do I miss something again :question:

AFAIK there’s a “stack system” that lets you pause the number of scenes you want, I could be wrong, can you make a small test to confirm? :slight_smile:
The limitation I can remember is that you can pause a scene A to go to B, but then you can’t pause B and go to paused A, to have two “rooms” saved and synced.

I was trying to make a dress up game for mobile, but when I added the click conditions and events, the game became slow and started to crash.
but … I have to take into consideration that was added to the game over 1200 sprites …
unfortunately, it became impossible to finish …

It seems we have only 1 action to go back to the previously paused scene only.

I never really used this feature so in case it is possible to pause one scene after an other as many as we want and then go back to any of the paused scenes, I can’t find any action to do it :stuck_out_tongue:

I (almost) remember I did complain about this and I think 4ian told it is intentional to let people pause only 1 scene at the time to avoid that people forget they have paused a scene and using up all the memory with paused scenes they don’t even know about. Maybe it is possible to stack them internally but 4ian decided not to offer an event to expose this feature :question:

Did you try it with other devices running a different version of Android, having better specs?
Also if you have 1200 objects on the scene and you do interact with most of them, make sure you are checking conditions and run actions only on the ones that is visible. For example if you have a bunch of hats to choose from, you probably hide them and display them when the player click choose hat, so the idea is to make sure you check conditions on those hats like did the player clicked any of them only if they are visible, if you are not doing it already…
The best thing to do is put them on a layer, hide the layer (not the objects) and check if the layer is visible before doing anything with the objects on the layer. Also, when one layer is visible you may want to hide others and do the same, so you are checking conditions and executing actions only for 1 layer at the time. For example when you choose hats, no point to check if player clicked the legs to choose pants…etc hide that layer or switch a variable or something.

This is a good idea, I used variables, but i will try a different solution.

Thank you very much for your help!<3