The most bizarre performance issues of any game ever, I think

For the last three months I have been optimising my game code to no avail.
People with 3060 gpus? solid 30fps.
People with a gtx 1650? ah, let’s give it 60fps.
Integrated gpus? 30fps.
gtx 1660 super? 60fps.
Another friend with a gtx 1660 super and a better cpu had 55fps however!
Oh, and an rtx 3050 runs this game at 20-25 frames per second.
What in the world is happening? I have optimised everything that you can optimise. I have added trigger onec everywhere that is physically possible. I have added LIMITS ON HOW OFTEN text objects can update, I have compromised graphics and game quality to try and fix the performance and I basically never use “for each object” events.
Meanwhile I run this game at a stable 60 fps.
The issue is impossible to identify. A person has reported to me that the cpu usage skyrockets at a certain point in the main menu but there is literally nothing in the main menu code that would allow for this to happen as it all triggers once.
The debugger is damn near useless and it doesn’t provide me with any semblence of help at this point. If anyone has had performance isses before and has fixed them, please comment down below some viable fixes or common mistakes.

1 Like

Welcome to my world.

Its not your machine or your events, code, objects, whatever, its the Engine.

Iv done hours and hours of extensive testing with all sorts of stuff and then some. Nothing.

Something like alt tabbing can permanently, drastically, change your performance for that specific boot of the game, then you boot it again and you have a different kind of performance.

GDevelop is so random and temperamental iv considered just buying it a box of chocolates, give it a foot rubb and tell it i love it and that ill never leave it for anyone else… works with the misses when shes being like that… maybe, who knows…

In all seriousness… its the engine, people have been ignoring it, the devs ignore it… as if its something thats rooted deep in the engine and the work to fix it would be too much and lord knows you cant stop working on the GDevelop “Credits” and how to optimize the “Mobile App” levels of monatization comming in a near future,

Sorry if i sound salty about this, but i am, performance is nutts in this engine and everyone acts as if its perfectly fine, must be your “events” for sure.

Iv gone down the same route as you, iv optimized my big project down to being a work of art, with every event locked behind some sort of check.

Did testing to see which events are more costly on the performance, to the point of ditching every extension i could, like the “Health” one, making my own damage and health system that was miles faster and more efficiant…

No result.

Turn it off and on… back to 60fps… Alt tab? back to 45… Open Chrome? back to 60… Sneezed you say?! back to 30.

But its fine, must be user issue.

I’ll go through the general list of things to check before anyone can give guidance:

  1. Do you have Max FPS set in your project? (this is important/slightly impactful because electron and all browsers are hard locked to having VSync on, meaning that if you’re setting a max FPS of 60, and you’re on a monitor that is at 72/75/144hz, Vsync will force it to bump down to the next nearest divisor, since 60 doesn’t evenly go into any of those)
  2. Are you currently using any extensions? If so, which?
  3. Are you using any object and/or Layer effects?
  4. Do you preload all of your audio files, only some, none at all?
  5. Does it happen in all scenes of the game, or only some?
  1. Nope, no cap on the fps.
  2. I am using pretty much exclusively tweens and the bounce extension but i use it very rarely. Also screenshake i think?
  3. I use outline effects on a number of sprites but that’s about it (and before you ask, yes, the number of objects is tightly regulated and doesnt overspill or anything like that)
  4. None, nada.
  5. Every single scene.

And yeah before you aski will just clarify that i use trigger once everywhere where possible and I have limited the frequency of every event that I viably can.
Another person has skeemed through the code and he said it’s incredibly clean and probably as optimised as it can get so i have no idea why any of these problems are occuring lmao

1 Like

So I can only comment on the items that I am specifically familiar with, but as there are quite a few folks out there with games basically using “all parts of the buffalo” (all engine features in 2D or 3D) without issue, I’d want to see if I can help narrow down the potential source of the problem for you.

Here’s some quick thoughts:

Hmm…If I remember right, outline is pretty CPU heavy, and object effects are going to be slightly more intensive than a layer-wide effect (after 2+ individual object effects of the same type vs 1 layer effect.) I’m going off ancient memory and can’t find the thread that talked about this when effects were being implemented, so I could be misremembering.

You might test by making a build where it’s disabled across the board, then send it to the folks who were having heavy CPU usage, and see if there an impact.

If there is a difference in performance, you might be able to reduce impact by having a separate layer for things that need to be outlined, put those objects on that layer, and just sync up their camera with the base layer. If I am remembering right, this should reduce the amount of individual effect draw calls that have to be done in a single frame.

Tweens are also math/cpu heavy, but normally only impactful if they’re not initiated with a fixed start (trigger once or a boolean variable on the object that is a required condition to start the tween, then immediately gets toggled to ensure the tween is only started once).

Do you have any tweens where you’re updating them every frame? (are they all using booleans to start/stop/etc? Are you using tweens for something that would be out of their normal scope (updating the tween destination/value every frame?)).

I’m not familiar with how the screenshake is built, so I can’t comment there.

1 Like

Those are some good points to try, especially with the effects. I never considered that this could actually be the issue!

As for the tweens, all of them are started with just a Trigger Once.

I will see if the game’s performance changes if I use your method for effects.

1 Like

alright, after trying your suggestion i’ve noted that the main menu lag has been completely dealth with and it’s smooth as butter now on my rtx 3050 laptop. in-game however, while the performance has improved, the game is still really unstable and even dips well below 30fps at certain points.

the lag in-game might be in part due to the fact that i forgot to remove some effects from around 6 objects before packaging and didnt disable a blur effect on a layer which could’ve totally been causing a bunch of lag as well, but i think the issue is still elsewhere. i’ll keep looking into it when my daily packages refresh

1 Like

Glad to hear it’s at least helping isolate some of the issue.

One thing I wanted to call out, on the mention of the laptop:

Please note that some laptops and their GPU drivers are notoriously bad about detecting browser/HTML5 games as needing the dGPU to render it, so they fall back to Canvas (software) rendering. Canvas rendering will basically destroy your performance for anything that uses effects at all, as well as some things like tiled sprites/etc.

Sadly I’m not sure of a universal fix for this, as I don’t think it’s anything on the browser (Chrome or Chromium in Electron) side but rather how the GPU drivers decide to handle it. If your laptop does have an option to force apps to use the dedicated GPU, you might also try that.

1 Like

Even tho @Silver-Streak is probably right in some of this, theres still a big engine issue.

Case in point is all the testing i did in my project, without changing anything, sometimes it would run at 6ms, 60fps smooth as butter, and some times it would run at 14ms, lagging as all heck.

I even had this bizarre performance, where leaving the window at native 1280x720 size would run at 14ms, laggy, but then hitting the “maximize” and making it fullscreen would make it run smooth as silk at 6ms.

I went back and forward between the two sizes, and every time i changed, the performance changed… so weird… you think the smaller size would run better than the bigger one… but goes to show what i know…

Different boots, different performance, its not a GPU issue, mine as engaged and cool with plenty of space, its not a RAM issue, mine had plenty of space and its not a CPU issue since i had less than 50% in usage.

Even something like making the mouse move around the screen would tip and tank fps.

And btw all this random performance is documented in a thread i made with hours of videos and profiler testing.

All i got from it was Davy telling me to use the inbuilt chrome debug tools to get to the bottom of it, which is basicly a “just shut up” comment.

I done my part, just wish more people would come forward complaining about the random performance.