Adding Structures Is Progressively Increasing In Lag

  1. I have a lot of structures to add in this game I’m making, like 100+, I notice that the more and more structures I add manually, when i click global variables to scroll through them it was beginning to slow down, now there is a lag when I’m typing and adding other structures.

So is it better for me to declare the structures in the code rather than manually in the software via the global variables option, because at this rate it will be basically impossible as the lag seems to be accumulating, also can someone explain to me why it takes up so much memory when its just text.

With Gdevelop up before I click anything it takes up around 550MB of my memory, as soon as I click “Global Variables” and reveal the existing structures I’ve already added it goes up to 650MB, if I click in a box to edit/add a value it goes up to 700+MB, so as I utilize the feature it spikes in memory usage, whats going on here, should I just add all the structures as code in the events section till this “bug” gets fixed, or is it not even a bug and that’s just a consequence of how manual structure entry works.

  1. If I declare the structures in code, will the game I create still just take up that amount of memory anyways when it is executed?

That’s because the GUI renderer, React. Rendering a lot of variables and children makes react to create thousands of nested components, which are re-rendered each time you open it, add or delete a variable, or change a variable name or value :frowning:

So, this may be improved in several ways, for example render only visible variables while you scroll, re-render the modified variable only, etc. But don’t expect to be fixed soon, the editor lacks basic features, then the performance and QOL improvements come :slight_smile:

If you have to add so many variables and the lag is so bad I strongly suggest to do the variables creation in code. Even better if you do it in an external event, so in scene you only add a Link event, and don’t lag the events editor with thousands of actions :wink:

I was planning to create a bunch of external events at first but I was disappointed that it was set up in such a way that you can only link an external event to a single scene, why is that?. Why can’t it be linked to multiple scenes, if it could I’d partition everything off I have so far into external events.

These global variables are going to be utilized in various “modes”, each mode is going to be a different scene, so creating the structures externally would not work at all as I can only link it to a single scene. The structures are integral to the entire game, so they pretty much have to be declared (all of them), at the beginning of the game. So if I do create it externally it will pretty much be linked to declare the structures in the main menu (at the beginning of the scene).

I’m just going to declare them in code in groups. Ironically though even if I start over now that method will be faster than entering them manually using the global variables editor. I found it somewhat annoying that you could copy structures but could not specifically choose where to paste them, that would have sped up the process, instead I had to click the “add variable button” X amount of times and then copy and paste the variable names. Since I’m entering it as code now I can just copy and paste the same layout over and over and then edit the variable values.

Thanks again

You can link the same external event in multiple scenes, the editor ask for a scene to get a context of the available objects and variables :wink:
(Just a context, you can use any object name actually, if the scene you link to the external effect has such object it will be used)

1 Like