[SOLVED]Performance issues with my biggest game project after creating over 100 scenes, 20 enemies, 10 playable characters, few items and weapons, 64 levels and too much materials like music, sound fx and sprite sheets!

Ok so, i started creating my own advanced 2D pixel platformer in few years ago and my game started lagging after testing 22 level scenes and i tried my best optimizing my event sheets like collisions between players and enemies, fixing the player movement, climbing the ladder and swimming in water everything animated and anything else, it’s still lags after playing a hour straight. Do anyone have idea how to fix it?

You say yourself that you are too heavy on use of resources. So the solution would be to cut back on use of resources.

Other than that it’s very difficult to help you without seeing the project. Make a video showing what is going on.

I’ve seen a number of times where game slowdown was caused by using For each object events. These should be used sparingly, and only once the objects have been filtered by a parent event & condition.

You can use the debugger and event groups to identify where the bottleneck is in your game.

Additionally, here are some links to performance discussions:

  1. Events arrangement and Hide and show event (SOLVED) - #5 by arthuro555

  2. Perfomance Optimisation on Large Projects - #3 by arthuro555

  3. Performance nightmare ... a small but helpful story (you can share yours too) :)

  4. https://wiki.gdevelop.io/gdevelop5/events/draft-optimization

  5. Profile your game - GDevelop documentation


https://youtu.be/vdbvbsYmVec There’s some debugs.

1 Like

from a brief look it seems that you don’t do any object culling. Do you update the entire level and all entities or just what is being rendered?

1 Like

My levels is builded with Tilemap editor exported into PNG and imported into it but that doesn’t cause lags!

ok. But do you perform object culling?

Unfortunately, this is incorrect in most cases.

Tilemaps are very performant, because each tile is a small image and is automatically culled (not rendered) whem that tile offscreen.

A tilemap exported into png is no longer a tilemap object at all but just one large sprite. If it is a large size (larger than one screen) it cannot be culled until it is entirely off screen. If you have a bunch of large PNGs imported, it can and will be worse performance and cause performance issues/fps drops (also lag is a network term and input latency term, not a fps term, you should avoid trying to use it that way).

Also, in regards to pers question/suggestion around culling, while gdevelop automatically culls (does not render) any object that is fully outside of the camera, it doesn’t stop proccessing logic/events for those objects.

If your event logic is always running on every object in the scene, even if they are off screen, that will have some pretty tremendous performance inpacts, especially if there is a bunch of “for each” events, as MrMen mentioned.

1 Like

Well i guess i never exported the larger tilemap level into json file but directly as png, and then in gdevelop i inserted non-tilemap object. I got 64 large tilemap level png images.

This is before i have to slide my tilemap level images.

And this is now if it’s only way to optimize it?

I didn’t yet but i don’t know to do it with full largest tileset image.

From the video, the profiler shows the events that are process hungriest are the 3 Enemies (Minions, Bears and Zombies) Player-Ladder and Player-Movement.

For Enemies, it looks like the Reaction and Seperately sections are the biggest hogs. Could you screen snip one of those, or make a video where you page down the events in the Reaction section and also the 2 player sections I mentioned

I’m making the assumption that all these Reaction sections run along a similar format, so if one can be sorted, it should fix the others.

1 Like

https://youtu.be/7gM4hf_ZfW4 This is my event sheets.

https://www.youtube.com/watch?v=uEKGvWIJI4g and don’t forget to see my gameplay trailer of them how much hard i spent a lot of time making this game.

Noting obvious springs out. Sure there is potential for refactoring, but if it’s not slowing down until quite a number of scenes in, then it might be due to an accumulation of processing.

So I guess the question it- is the slow down gradual, or does it suddenly kick in at level 22?

The game starts lagging after beating 22 level scenes while playing a hour straight!

Can you start the game at level 22 to see if the slowdown kicks in straight after? It’s to eliminate or confirm that it’s the scene that’s the problem.

When i just started at level 22 or other levels it doesn’t lag at all. Just when you played 22 or more levels each scenes for 1 hours or more, it does lag.

And is this slowdown gradual or very sudden?

I have no ideas what is slowdown gradual or very sudden? Like i told you my game goes slow by droping the frame like a old toast computer! I actually have a true gaming pc.

I believe what they are trying to ask is if it is slowing down per level (like 3 is slower than 2 which is slower than 1 etc.) or if it is fine until you reach level 22 which then you suddenly start having performance issues.