Tons of Variables or constant INI reading?

For questions about using Classic.

Post » Sat Jun 06, 2009 4:40 pm

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?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Sat Jun 06, 2009 5:03 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sat Jun 06, 2009 5:08 pm

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?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Sat Jun 06, 2009 5:18 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Sat Jun 06, 2009 5:37 pm

Awesome, thanks!
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests