[Plugin] Globals

0 favourites
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.
  • Oh right, that way. I guess it's an interesting idea.

  • Ashley [quote:3o0uf9js]For example you could use 10 static locals inside a group, when only just that group uses them, and they never appear anywhere else in the event system, and the variables themselves are close to where they are used. I think this is an under-used feature and would do a lot to solve the "global overload" problem.

    Speaking from experience, from a non-programmer background noob,

    It takes a few runs to figure out why using all global variables is a bad idea,

    in fact it takes a few runs to figure out how to use things like groups and functions and local variables properly

    its only when you start to understand and use these sort of features that you really begin to appreciate what you guys have achieved with Construct 2.

  • This looks excellent! Normally i do bools with a global using 0 or 1 but nice to have a true/false and not pollute the event sheets.

    Whats the deal with using this as part of a commercial release?

  • For example you could use 10 static locals inside a group, when only just that group uses them, and they never appear anywhere else in the event system, and the variables themselves are close to where they are used. I think this is an under-used feature and would do a lot to solve the "global overload" problem..

    That's exactly the point and I have mentioned that in my article as well. Whenever it is possible you should encapsulate your project as much as you can. The code architecture is crucial in development, especially for big projects.

    Then if you still need some variables with global reach the Globals plugin comes handy.

    you are free to use any of my free plugins in your commercial and non-commercial projects without any restrictions. You are also not obligated to credit me or something - it's fully free.

  • Hi Guys, I've updated the first post of this thread. Globals 2.0 has just been released.

    == UPDATE - New extended version ==

    Globals 2.0 is now available in Scirra Store (note that Globals v1.0 is still and will remain free).

    Globals 2.0 is an extended version of Globals plugin with the following extra features:

    • Compatible with Globals 1.0
    • Save/Load variables to System storage
    • Save/Load variables to LocalStorage (or any other place by export/import JSON)
    • Reset variables
    • Can be used as a "struct" data object

    For more details and the video please visit the Globals 2.0 store page.

  • Awesome Toby!

  • Globals 2.0 is now also available for C3 .

  • Globals 1.0 is now also available for C3.

  • Hi! Please correct me if I am mistaken.

    The system global variable is checked on all events of a events sheet.

    Instans variable is checked by a call in an event.

    I so understand, Global is checked as instans?

    Something like invisible instans on a global layer?

  • Hi! Please correct me if I am mistaken.

    The system global variable is checked on all events of a events sheet.

    Instans variable is checked by a call in an event.

    I so understand, Global is checked as instans?

    Something like invisible instans on a global layer?

    Hi repkino,

    I don't know what you mean by "is checked on all events of a events sheet". Neither the native global variables nor instance variables are checked by the engine unless you code the check as a condition or expression.

    Instance variables of Globals plugin are exactly the same instance variabless as you use in any other plugin.

    Both native global variables and instance variables are accessible globally. If you want to read more about the differences, you can read the article which I also linked in the very first post here: http://tobyr.wtfgamesgroup.com/c2-plugi ... variables/

  • I have read article and I use Global2.0, thanks)

    Forgive for my English. I mean that global variables in comparison with instans variables can strain the processor very much. I try to avoid them for this reason.

  • Variables (any kind) are one of the most basic elements in any programming language. Normally varaibles are actually just pointers (a kind of arrow that points the RAM area of where the data is stored), in Construct they're a bit more complex as they go via event sheets but still variables are the lightest elements I can think of. So no matter if it's a global or local or instance variable, they do not affect the CPU, no worries about that.

  • It is clear, many thanks for the answer.

    (Probably all the matter is that the wrong code and global variables can create more problems, than instans)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the plugin! I only wish you published it a year ago.. (Or at least that I found it sooner)

    Any advice on how to quickly replace lots of global variables with Globals.variables in a big project?

  • Any advice on how to quickly replace lots of global variables with Globals.variables in a big project?

    I must say I hear this question very often but I'm afraid there is no magical way to speed up this process. You have to do it manually. All I can say is that it's worth it (unless the project is nearly finished) no matter how big your project is, cause it will benefit your future development.

    Good luck

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