Tons of Variables or constant INI reading?

This forum is currently in read-only mode.
  • While I'm waiting for 1.0 to come out and work on my project in earnest, I thought I'd get some questions out of the way.

    My game will need to keep track of a bunch a variables, some fixed and some variable (a variable variable, I get it!) and I'm wondering for the fixed vaiables would it be best to load them into the sprite's private variables or constantly read an INI file to get the value? I'm talking about a couple dozen private variables (weapon strength, engine speed and acceleration, etc.)

    If it's in a private variable, then I would think it'd be more efficent because it'd be in RAM versus the INI being on the HDD.

    Any info?

  • I think INI constantly access the disk, which could be bad for performance. So if you use a hash table object or something which is always in memory (except for the one time you use a 'load from file' action) then it should be a lot faster.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok. That raises a question, 'cause I've never worked with a hash table, and I am currently using INI to store items (engines, weapons, etc.) and would like to be able to add more items for modding purposes or expansions after development.

    So... Is there an easy way to load an ini with multiple groups into a hash table or Is it something I'll have to work out?

  • Well, if you need that, you could use an INI - just load all the variables on start of layout then it won't constantly access disk.

  • Awesome, thanks!

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