which data object to use for save system?

For questions about using Classic.

Post » Sat Jan 28, 2012 11:25 pm

Out of Hash Table, Array, and INI-- are they all just as quick, and it comes down to your preference in how you like to store data?

I have a simple save system in mind-- the game saves when you leave a layout, I have maybe 50 variables to be loaded when you enter that layout again (locked doors, opened chests, etc.) Also a simple Zelda style inventory (either you have the item or you don't)...

Easy to keep track of no matter which data object I use.

B
5
S
1
G
2
Posts: 99
Reputation: 1,575

Post » Sun Jan 29, 2012 12:34 am

I'd say, time does not play a role in this scenario. Of all three, ini is the slowest, because it needs to convert strings, but that's a matter of milliseconds per line. As long as the amount of data stays that small you're free to use whatever pleases you the most.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sun Jan 29, 2012 1:21 am

personally I prefer arrays,
but in-truth i don't know much about using .ini
only seems they way to go if your using it for text or something that you manually need to change often.

plus .ini files are easy to modify and cheat.
B
6
S
2
G
5
Posts: 249
Reputation: 2,323

Post » Sun Jan 29, 2012 2:22 am

There are ways to scramble and protect your INI files from the prying eyes of players. Even then, wouldn't they have to understand my idiosyncratic PV naming? Thank you.


aldo2012-01-29 02:48:33
B
5
S
1
G
2
Posts: 99
Reputation: 1,575

Post » Mon Jan 30, 2012 1:40 am

That's funny, lol. I was just searching about a very similar question, hash tables vs arrays. I didn't find that much yet, just checking the Help Section for some recent things, and I see a topic about almost exactly my question.Shindoh2012-01-30 01:41:14
B
3
G
1
Posts: 70
Reputation: 615

Post » Mon Jan 30, 2012 7:01 pm

@Tulamide: Time to post your links about arrays and hash tables.
Too busy right now to find them all.zyblade2012-01-30 19:01:46
B
24
S
9
G
2
Posts: 294
Reputation: 3,160

Post » Mon Jan 30, 2012 7:33 pm

Arrays and hash tables have different benefits usability wise. An array is basically a big grid of values with no names. Hash tables have named values, but no real grid.

I got the benefits of both by using both and when saving, running a loop for each key in the hash table, saving its name and value into the array, and when loading, running a loop to create the keys.

If you use this method, just remember to make sure that the array is big enough to store all of the keys from the hash table.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Mon Jan 30, 2012 8:26 pm

Here is a link about arrays and hashtables, incl caps demonstrating them:
http://69.24.73.172/scirra/forum/viewtopic.php?f=8&t=8400
--------------------------------------------------------------

@Arima, I wonder why you do it so complicated? Without any further info it seems to be unneccessary (you can just save any hash table to file with the same ease as saving an array).
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Jan 30, 2012 10:57 pm

To have one save file with both array and hash table data. It's actually not nearly as complex as it sounds.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests