Preview lags, but profiler still shows good numbers

After refactoring, part of my game started lagging. The game runs good when started but becomes very slow in the preview after a while.

I tried to pinpoint the issue in the profiler, but the performance of the game is actually better “on paper” than before. It does not show any longer ms on any of my events.
When I profile while the game is running good in the beginning I am in a 5-10ms range. When I profile during the lag it is the same.

I have also an ingame FPS display, which drops from 60 to 30 only after the game is already much slower and unplayable. The FPS is made via the

"FPS: " + ToString(ceil(1/TimeDelta()))

… event.

Has anybody encountered this, that performance issues are not reflected in the profiler? I am using git a lot to switch between versions - so I have a good comparison to my version before the refactor. Could it be that git is messing up some caches of GDevelop or something like that?

For me it sounds like you either create some object constantly
Or you are are firing bullets and not deleting them

I have checked and will double check my instances on the scene.

But would this not also be reflected in the profiler in the event that creates the objects constantly?

Never used profiler so i have no idea
But i guess it should show something like that

I would try toggle disable group of events until i find which is causing it

For me it was always something that was expanding/creating/moving infinitely

1 Like

I’ve encountered something more or less similar. In my case it was smoke released from missiles.
The smoke particles were set to be deleted upon finishing their animation. But they were set to not play their animation if outside the screen. So everything not visible on the screen just piled up. I even tried adding a counter for them. Turns out I could go to around 5000 particles or so before things start to lag.
The profiler did show the increase in processes though.

1 Like

Thank you for your comments! I have found the issue!

tldr: I had effects on a lot of individual assets, and I was not aware of it.

To round this up:
I had placed color map effects on a lot of assets as a quick and dirty way to make them fit into a new color scheme. After this was obsolete I wrote code to simply disable the effects for these objects again. During my refactor I removed this disable code, because I thought it was not used anymore. This effectively switched on the color map for a lot of assets. The effects were however not visible, because it is a 1bit/bw replacement map. It made things that were white, white and things that were black, black effectively.

Removing the effects on all the assets solved the problem and brought the performance back to old levels.

2 Likes

I am still a bit puzzled why this was not shown in the “Render” section of the profiler.