Solution / Problem Solved:
To anyone reading this with problems regarding Lag / Performance dropping after changing scenes, on a game that uses scene swapping a lot.
At the time of writting this the problem was found to be the “FlexBox” Extension, it has some sort of memory leak, not deleting data on scene changes. Removing this extension will fix the problem, at least it did in my case.
Thanks again to the Devs for being so quick to find it, hope this helps anyone with the same problem!
As my game got bigger i started to notice FPS drop over time as i was play testing, i thought it was fine, just some performance issue on Previewing the game.
But its not.
When the problem got so serious it began to break the game, with the game running so slow it had a hard time updating variables, scene elements breaking, all sorts going wrong, i looked it up to see if anyone else was having the same problem.
What i found was that, there was plenty of people with the same issue, more to exactly the issue everyone is having is this:
- If your game is heavely dependent on changing scenes frequently, as in using a scene for each room in your game and then changing between them frequently, the game starts to slow down, as if its not deleting the previous scene, keeping something in the background and pileing it up untill the lag is too much.
I have this EXACT issue and this “Memory Leak” bug seems to have been introduced in a GDevelop update, the evidance for this is that some people have tried rolling back to previous versions and that fixes it.
Before anyone goes saying that its probably something user related like “Events” or whatever, just stop, its not, me and other have tested and tried to fix this, it has nothing to do with the user, its PRECISELY A SCENE CHANGING ISSUE, its the scenes that trigger the pile up or “Memory Leak” kind of bug.
MY EVIDANCE for this:
I just finished redoing my game to use a single scene.
Im using the EXACT same quantaty of objects, the same variables, the same timers, evetything is the same, THE EXACT SAME to be perfectly clear.
The ONLY change is that now, instead of changing the scene, i instead delete everything in the scene and then create the new room with external layouts.
The game plays the same, uses the same things, everything is the same, i just dont change scenes… and the result? SMOOTH 60 FPS no matter what.
I even increased the load by spawning a bunch of objects, still smooth 60FPS, rock solid, unmoving.
Its 100% an issue with the act of changing the Scene, something goes wrong when you do it, it tanks your performance like crazy and the more you do it the worse it gets.
If you think you dont have this issue and you use lots of scene changes, your wrong, my guess is that your machine is hideing the problem by over speccing the game, but give it time or run it on a slower machine and youll see the FPS drop untill it breaks.
I did all sorts of testing, i bullet proofed the scene changes with preload, load, stop scene, all sorts of trial and error situations, monitored performance multiple times on the debugger troughout the play test nothing fixed it because its an INTERNAL SOFTWARE FLAW, something broke in an update, thats all, stuff happens, just please stop ignoring it, its silly to be afraid to use more then one scene.