How to approach variable modularity in newer GDevelop?

Hello. I’m hoping to get some input on my situation. I came from an old version of GDevelop. I’m using the newest version now.

Previously, you didn’t have to define any variables before previewing, you could just change the value of any non-defined variable at any point in the event sheet and the game just handles making that variable and setting the value. Now, you have to define the variables first before you can use it, otherwise it wouldn’t work.

Before this I created external event sheets that functions as modular game types. As in, by adding a specific external event sheet and some objects in the scene, you can have a game type ready to play.

My use case involves a lot of reusable ‘game types’. But they wouldn’t work anymore in the ‘plug and play’ sense in the newest version if I used the newer variable approach where I have to define all the variables first.

Is it no longer possible then to just have variables ‘confined’ in the external event sheet? As in, just put the external event sheet and it works. Now, the developer has to go through the external event sheet and define all variables in it before it works?

Any suggestions on this? Sorry if it’s a stupid question. If there’s a better way to approach modularity please let me know.

Yes you need to declare them 1st

Even if they are not always used
I was against this change and i still am
Well maybe i more of am against taking away old system and replacing it with new one
I would be perfectly ok with adding new system while keeping old system
BUT whatever

BUUUUUT i want to point out to you and take it deeply into your heart
Almost 3 years i see how on discord and here ppl had problems with changing value for scene variable
Where they were checking global variable
How they were changing HP variable but checking Hp variable

This YOU NEED TO DECLARE VARS solved all the above problems and many more

Right now you declare HP variable
And you used 100 actions/conditions in events with it

Now you go to variable window and rename HP var to Health
And it is auto renamed in any events action/condition it was used

With previous system you would need to manually go trough event and rename all of them in hope you did not miss any

I still miss old system
BUT i cannot argue how much new system not like solved
But removed option to make mistakes + streamlined managing vars

So i would say the faster you adapt to new system the better it will be for you
Cause it is worth it

1 Like

Ahh I see. I totally understand the trade-off. Thank you so much for taking the time to write out everything and for your empathy. I’m glad I’m not the only one that misses it and find it useful, although flawed.

1 Like

That sounds like a hassle. It would be nice to have an export/import that would handle the variable creation.

You might be able to at least reduce the effects by using a few local variables, if possible. Those are declared through events.

Creating it as an extension, behavior or a custom object might also simplify things.

1? year later and i’m still not sure about it…but…
:man_shrugging:

Do not confuse something being better and something better for someone
Knife or hammer which is better?
Depends if you want to destroy something or cut something

I do not make games
I come here fix ppls crap same on discord
I have test project which i use to show events and prove something works
For me it would be better to have old system to use variables on the fly without declaring

For every single other user new system is better
You cannot anymore:

  • Check 20 times in events 100 events above what was the name of variable you need right now
    For example name variable HP then check for variable named hp
  • Set global variable to 20 and check in condition if scene variable is 10 and wonder why it is not registering
  • Check in condition if variable = true and in action set it to 0
  • Wrongly address variable you name of variable cause it will be red indicating error
  • Need to rename same variable in ALL EVENTS across whole project instead just in variable window
  • Same as above one but changing variable type

I hate this update cause for me as someone who solve other ppl problems and just need to use variables and not declare them
This update took away something very useful from me

BUT as i sit on help channel on discord
Since that update was deployed i magically stopped seeing issues i mentioned above
Like it is impossible to make these mistakes anymore

So even so this update was tragic for me and i can curse it all day and night
I cannot argue over how much for other users it improved
And how it streamlined workflow for them

For what you are describing, it might make sense to make them into function based extensions?

You can predefine the variables in the extension, and can be reused as needed. The difference may be that you have to set up actions to modify those variables outside the extension (assuming you need to)

1 Like

I’ll look into this. Thank you for the suggestion!

1 Like