New unified variables and variables declaration in GDevelop 5.4

:slightly_smiling_face: that is what i offered above…but with autodeclaration…If GD knows which var you wrote it should be simple to add automatically to the vars list.
This is not a turn back, cos it will get rid of undeclared vars, but they said old conditions are too verbose…(so i guess they’re not going to happen) that is your answer

Hey,

Just giving my opinion on some things discussed here.

This sounds like a nice feature… but I don’t think it works in all situations. I’ll explain what I mean.

  1. In the case of a simple variable, eg: NewVariable, this is fine.

  2. In the case of arrays or structures, eg: Structure.Child.
    If Structure is not declared, then GDevelop would have to declare both variables.
    So Imagine if I type 3 or more new variables into the field, eg: Structure.ChildStruct.ChildStruct2.Child.
    Maybe this is also OK to let GDevelop create multiple variables all at once?

  3. In the case of expressions.
    Eg: Structure[Name].Child -or- Array[Number].Child.
    How would GDevelop know where to declare the variables?
    It doesn’t work in this case.

  4. With the current system, how would you tell GDevelop whether to declare the variable as a scene or a global variable? This would add an extra step.

I don’t think a feature is good or worth adding if it doesn’t always work.

Having 1 action/condition for scene & global variables allows to easily change a variable from one type to another. I find it way more useful this way.

Imagine you used a scene variable throughout a big project, and later you decided to change it to a global variable. Now you can simply delete the scene variable, declare it as a global variable, and you’re all set.

But if the events for scene & global variables are different, you’d have to search for all the actions & conditions and replace them manually. I faced this issue before and many hours of searching and fixing errors later, I finally was able to do the change. I’m not very good with math, but I think this is a LOT more time than simply delete → declare.

I have to disagree here. Check this topic out: [Feature in Backlog] A more efficient way to declare variables (from event sheet) - #14 by Luni

I always declared manually structures and arrays. Since i’ve always considered them “more complex” to remember. I guess it’s like this for the majority here…ofc autodeclaring from conditions will not gonna work…as far as i know it was like this even before.

Did it happened to you?..
this is what ppl above asked (not me).
Do someone complained about variables system in the latest 3-4 years?..
Ofc it doesn’t mean that if something works it couldn’t be improved…but has it been improved?..and you know what:…i can’t judge it,…lol… cos i don’t even tried it…for one simple reason…i already have too many clicks …and i’m at a lower ver.

eg…do you hate now amazon cos it had to put spot on prime?..or to click pop ups to watch something in streaming…doesn’t it breaks your “workflow”…lol…personally i find it irritating…but for others may not be

Maybe I should not bump this up but would like to share a couple final thoughts.

I’m 100% agree, from a business perspective, the primary focus must be to meet the needs and preferences of professional developers with large projects and apply good practices. However, I would also take in to consideration the fact, this is what every single game engines out there focusing on. As I mentioned before, it does not make GDevelop stand out in any way. If GDevelop does the same as every other engine, why anyone should use GDevelop instead of all the other professional engines out there, many of which used by big AAA studios.

I think it is worth considering to maintain a balance to keep GDevelop relevant in the beginner space, not only as an alternative but the #1 option and it is just my opinion but event system alone and some templates and behaviours may not going to be enough as almost every engine out there do have some sort of visual coding solution.

Since the changes are set in stone and decisions are final, I would consider the approach of Visual Studio which is to display a “Fix it” button next to the warning or error message and the IDE literally offer a list of actual solutions you can choose from

WARNING: variable is not declared (Fix it)
decalre as scene
declare as global
declare as local

When the “Fix it” button is clicked, a menu popup with a list of options to choose from. It feels the most beginner friendly option to me that can be documented and easy to use.

2 Likes

As you have noticed they don’t want undeclared anymore.
So a method to declare the undeclared…is pointless…imo
The only thing usefull is a method to declare all variables as fast as possible.
Even a method i suggested above has not been taken into consideration…hopefully (for sure) they gonna do better.

…just forget about undeclared…guess they gonna get rid of em in near future

The fact undeclared variables no longer allowed is not really the problem in my opinion, I am more concerned about the beginner user experience of being overwhelmed by all the new concepts and menus need to know in order to be able to build something. For educators it could also be overwhelming to teach so many different concepts to students before the students can build anything on their own.

In case you are referring to declaring scene variables automatically, as 4ian explained the problem with this is that GDevelop doesn’t know if you need a scene or global variable. If GDevelop declare a scene variable by default but you need a global variable then you need to go and edit the declaration and it would create a workflow that is difficult to document and not very intuitive.

This is why my recommendation is simply a Warning with a “Fix it” button similar to Visual Studio and a list to choose from if you want a global or scene variable. Nice friendly yellow warning, only 2 clicks to fix. Not much trouble.

1 Like

Add object variable as an option too.

I’ve explained above how to fix that too…but i don’t want to go into detail again,
surely they gonna find a proper(better) way

So guys am I got it right - now I need to declare variable with my hands for each objects in objects list (its going to be ~ 50 characters) just to use their group in code?
Every time I want new variable i need to declare it 50 times with hands??

Or there is a way to declare vars to the whole group instantly?

maybe push for this? [Feature in Backlog] Variables for groups

3 Likes