Global Variable amount and performance

0 favourites
  • 6 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hello! My couple of questions:

    1. I am making a fairly large game and gradually the number of global variables becomes big (about 50). Not all of them are used frequently. Therefore, I began to think, or maybe it is worth taking out the most unimportant of them, for example, in the Dictionary and accessing them through it? This is of course not so convenient, but I read articles on the Internet and many people say that it is better to avoid using global variables unnecessarily. Will reducing their number by 10-20, affect performance, or is it all too insignificant?

    2. Is it true that if I enable the "Static" parameter for a Global Variable which will not change, this will increase performance?

    I would like to know the opinion of experts!) Have a nice day everyone! Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It won’t affect performance one way or another. Using something else is just to organize things.

  • It won’t affect performance one way or another. Using something else is just to organize things.

    Ok, thanks!)

  • The biggest problem in my opinion is that global variables slow down your work, because they "contaminate" dropdown lists. When you type anything in the expression editor, the list of objects and expressions also contain all your global variables. The more variables you have, the more difficult it becomes to find anything there unless you remember the exact name.

    In my projects I prefer to add invisible global sprites and move most global variable to these sprites (as instance variables). So, for example, all variables related to battle mechanics are in the "Battle" sprite. All variables related to farming in "Farming" sprite and so on.

  • I find I use dictionaries a lot. Bad because yeah, not very convenient when you can't see lists of keys when typing expressions, and bad because you can't change the icon of a dictionary so they all look the same, but good because you can reference dynamic names of keys when typing in the dictionary.get() expression.

  • Jase00

    dop2000

    Thanks for the replies!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)