Global Variable Question

0 favourites
  • 5 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.
  • Hi,

    my current project has a lot of global variables. It is being designed for desktop only.

    Does the amount of global variables have any adverse effect?

    Is there any advantage to using more local variables or arrays instead.

    Also the status bar on C2 tells me the current memory use for this project is around 74mb.

    Is that good or bad or does it make no difference on a desktop project?

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My Memory use is at 360mb so iI think 74 are very good.

    Global variables are just for the security not good, cause they could get changed from the user.

  • Hi,

    my current project has a lot of global variables. It is being designed for desktop only.

    Does the amount of global variables have any adverse effect?

    Is there any advantage to using more local variables or arrays instead.

    Also the status bar on C2 tells me the current memory use for this project is around 74mb.

    Is that good or bad or does it make no difference on a desktop project?

    Thanks

    It doesn't matter memory wise which kind of variables you use. Pretty much only difference between global/local/instance variables is visibility; using lots of global variables where it is unnecessary makes things really hard to control.

  • An array of 100,000 values doesn't even take 1 mehgabyte , I don't think 20 variables would take a lot

  • Global variables don't affect the estimated memory use in the status bar; that's exclusively determined by the images in the project. Compared to images, a global variable occupies negligable memory.

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