I have a hack n slash platformer adventure game which has 6 levels i.e plains, forest, ruins etc.
At first area (plains) game has no issue. But after I clear the boss and move on to the other area, game starts lagging so much it’s barely playable. I’ve searched google for issues and it says
But since I am just starting, I have no idea how to fix any of it. Can someone please explain and help me. This is my 1st ever game and it is almost complete just need to fix the lag issue. Thank you so much
You can use the debugger to see how many objects are in the scene and the profiler to check if events are using a lot of resources or time.
Start there. Post screenshots of the results if you want assistance interpreting the results. You could also post screenshots of the event groups eating the most time.
Hi - When you move into the new area - what happens that’s new? Are the objects in this area already on the editor? Is it triggering the creation of a new set of objects? Does it contain objects with a behaviour such as pathfinding attached? Could the old area be deleted by for example covering it with a large hidden sprite and when you move to the new area delete everything that’s inside that spite ? or you could turn off the behaviours on the objects in the old area.
This can happen because of adding some extension. In one extension, the code was incorrect. Everything!!!
The game was working fine before adding the extension, then freezes 1 frame in 10 seconds.
The main thing is that if you remove the extension from the editor, it will remain in the json and will ruin the game! You need to go into the json to remove the extension completely!
What extensions do you have?
Hi - I hadn’t realised that you were changing scene. like keith said above - look at the profiler. Its good to use event groups so that you can see which event groups are using the most processing
is it a cloud project? it looks like the images referenced aren’t in the asset folder and its trying to get them from the web address. Did you click copy to asset folder when you imported the images?
Do the filenames ‘gem’ or ‘flask’ sound familiar? They could’ve been an asset or asset pack that you downloaded or installed from the store or maybe part of an object like a prefab like a resource bar that had different styles. Gem could be a progress bar but both also sound like inventory icons. Check the resources tab for missing files.
Can you rerun the profiler and you expand the profiler window so we can see more of the results to see if there’s something eating a lot of time?
Hi! I’ve fixed every error in the console now it runs great, no lag whatsoever. But only in gdevelop preview, I exported it again .aab file since im on closed testing in play store. Still, it lags after every new area. Im so confused
Just take the assests and put them in the game, are you trying to stream assests? Also does the event have no condition or is it requesting every frame from the site? Cuz that will lag yo game.
I have 2 ideas either you’re streaming alot of assests at every frame and using them immediately. 2 either there’s an event happening non stop that is huge/lots of events happening b2b
Hello everyone. I have discovered the source of the lag. The reason is the “For each object” event.
Since I used for each object that enemies are; for example paralyzed, an animation is changed.
Even though it has trigger once, the game still checks each instance of enemies (Even the ones not on the scene) thus the reason for the lagging when moving to the next area because of new set of enemies created. Anyway thanks for everyone helping