Game performance drops after a while

Oh, so no attacking then? And what about the enemies? Do they have various states?


I think you’re missing the point. It may work as intended, but it may be doing so inefficiently. Have you looked at the following wiki topics :

Debugging poor performance. It has a section on creating a FPS counter. Make sure yours is like this, because you’ve mentioned lag but that the FPS is perfect.

And here are a list of URLs of GDevelop performance resources.


Not me, sorry. I’d rather have the project to pull apart and change things to test various theories over a longer period of time - I often mull things over for a few hours while doing something else. And that can take time, and repeatedly deleting the project and restoring it from backup.

I realise you’re not keen to share it with unknown people. However most of us here are more interested in our own projects than nicking someone else’s. And as for me, I’m only interested in helping others get their projects working.

1 Like

No I think I do know what your saying. It just sounds like to me if I set up a system like that it would just complicate the events unnecessarily and have to go through the same or possibly more condition checks every frame as opposed to what I have now, just because the way the player works is really simple in my game.

I did read every article about performance on the wiki, most of them twice, before even posting on the forum. My FPS counter is using the FPS counter extension, which I assume just handles it the same way the wiki recommends. I’ll try it the other way though.

Overall my performance is really good for my amount of events, I think. My average now is 2.4-2.6 ms when running the game normally, and that’s with hundreds of events. I just don’t understand where this unaccounted for ms is coming from in the profiler. I recently noticed that if you add up all of the ms from the events section in the profiler even when the lag hasn’t started there is still a small percentage unaccounted for anywhere in the events section.

Update: I changed the FPS counter to work the way the wiki recommends and deleted the FPS counter extension from the project. This FPS counter also can’t properly detect the lag at all. It drops from 144 to 60-75 when the lag happens but does not ever show the correct number, which I would guess is around 3 FPS.

I was thinking about it and I think you are right. Would you mind looking at it for me sometime if I DM the project to you? Also either way I want you to know I really appreciate the help you have given me so far. You and everyone else here, thank you guys.

For sure, DM when it suits.

Update:

I completely remade the scene transition system in the game to use the layouts feature instead of actually switching scenes within the engine. Now instead of using the “Change scene to” action everything is deleted and the next room is loaded from a external layout during the room transition. The entire game now takes place within one Gdevelop scene.

As I suspected it would, this completely stopped the lagging issue. I did not change the events other than adding new events to make this way of transitioning rooms work. If anything the events are much less optimized than before. There is no lag whatsoever no matter how long I play. To me this pretty much proves 100% I was correct in thinking the issue was coming from the actual scenes changing a certain number of times and not any problems with the event optimization. I can’t think of a possible reason why this would happen other than a glitch with the engine itself. Then again I’m not an expert on this so maybe someone knows better than me.

If I were working at Gdevelop I would maybe look into this as game-breaking bugs like that can give smaller engines like Gdevelop a bad name. If I hadn’t been willing to completely redo my game’s room transition system ( and all other events that used “At the beginning of the scene” events ) than my game would be dead in the water.

Thanks to everyone who attempted to help.

4 Likes

Thanks for the feedback.

This mean you never tried to stop the previous scene when you call another scene?
I mean set to True the option in the action:

Because this option on True, clean all the objects and unload everything from the previous scene before openning the new one.


If the problem is 100% reproducible on any machine it is good to send the project to the devs so they can have a look.
I understand that sending a project to the public can be a problem.
In any case you can send it directly to the team by hello@gdevelop.io. Explain the problem a bit to give context.

I’m not saying that they will find the solution for sure because debugging is very long and exploratory most of the time.
But it could lead to something, maybe.

2 Likes

This month I switched to the newest version of GD to work on my new project because I want to use GD’s newest features. My older game, when worked on and / or compiled, in the new engine, has this issue. Opening 3 or more scenes sequentially, even if “Stop Previous Scene” is used, and being very careful with how the events are used, leads to massive slowdown to the point of being unplayable.

On 5.0.130, this issue doesn’t happen at all and I can open 50 scenes back to back with no slowdown. So it’s still an issue persisting with the newer build. Not sure why, but just wanna keep the devs updated on this.

For my new game, I’m just going to make it all take place in one scene, and just have different layouts happening within a single scene. This is a workaround, but of course doing this for my older game would take ages.

Well. I can confirm the very same issue. I am not sure how it was on previous builds, but on the latest one as of time of posting, switching between a lot of scenes eventually makes the game lag. At least, it can be cured by closing and reopening the game. Given that making a new scene for every level may feel intuitive and the fact it used to work fine (apparently), this might be a good issue to address.

Yeah, even on the newer build of GD I’ve run into a similar problem. The game starts to suffer extreme lag after around 15 minutes. So performance drops from 124-144 fps with same number of objects and actions, down to 80, down to 40, then down to like 25. Over the span of like 3 minutes, after 15 minutes.

This is STILL happening!

I have the EXACT issue and its NOT a user issue.

I have done all sorts of extensive testing and nothing works, its the exact thing, after 30 to 40 mins of play time and changing around 40 to 50 Scenes, the game becames unplayable with lots of Lag, breaking menus, variable updates and hit detection.

Any seperate Scene runs smoothly, on start it always runs smoothly, its only after extended play that it starts to break, just like your run of mill MEMORY LEAK.

GDevelop has a severe Memory Leak issue, the thing is, im guessing that people who are developing might be using more recent machines, wich helps to hide the memory leak, memory leak becomes far more noticeable on lower end machines.

Its as if when you change scene the engine dosent fully delete the old one, like theres something building up.

For clarification on my game, its just like the other guys complaining, each room is a scene, you go trough a few randomly selected scenes and then fight a boss.

The issue still presists, just because someone making 60 empty scenes with no variables or objects moving says nothing wrong it dosent means there isnt an issue, just means you did bad testing.

Im so disappointed, i had such high hopes for GDevelop, i was having so much fun and the guys behind it seemed good, it breaks my heart to know such a big flaw still exists after this long and instead of working to fix it, their instead pushing monetization with “Advertisement Packs”, sad really :frowning:

2 Likes

Hi! Unfortunately, I faced the exact same issue too.

I saw a Reddit post about it by @Blackjester57.

Seems like he solved the issue using only once scene and changing level items inside of it. I wish I had an example or detailed explanation.

https://www.reddit.com/r/gdevelop/comments/y56d5c/game_performance_mysteriously_tanks_after_a_while/

Hi there, thanks!

Yeah, i came to the same conclusion and fixed it by only using one scene, which is silly, but untill they fix the issue we got to make games this way or risk them breaking later on.

Hello,

Thank you for your feedbacks on the performance issues.

If you have a project with this problem, please contact the team or send me a message on the forum with the game files and the nature of the problem.

In order for this type of problem to be inspected by a developer, we need to be able to reproduce it and this is currently not the case as we are unable to reproduce the bug.

1 Like

To anyone still following this issue or having the same problem…

The Devs figured it out, the memory leak comes from the FlexBox Extension, so if your project uses it and has scene changes, youll come across the same issue.

They explained that the extension never releases the data on scene changes, thats why it happens.

GDevelop itself has nothing to do with it.

3 Likes