What are your ways to organize data for saving?

flyinian

Member
I am looking for ways to organize data to save.

I have a save/load system using JSON files and it appears to work nicely. Now, I am looking for ideas to organize data.

I have several "controller" objects that controls parts of my game and done this way for organizational means.


Could I place all of my data that needs to be saved into a ds_grid and save the ds grid by name? This doesn't seem to be possible for a varying amount of data that needs to be saved.
Instead, I could make several ds_grids for each type of data and do it that way.? I'll take a performance it this way?
Would global variables be easier and quicker than ds_grids?



Well, after some testing. I think i'll be going with just direct saving. Assign a global variable/ds_grid item/etc. to a local variable, save that local variable and then load that local variable back into the game on game load.

I'm still curious on how others organize their data for saving so, they don't lose track of it.
 
Last edited:

kburkhart84

Firehammer Games
It depends on the data. The trick to whatever method you choose is to document it somewhere, so if you need to add/change it later, you don't forget what it was in the first place. My input system in the past was using data structure strings, and just writing those in a known order to a text file, and then loading them in the same order. Many people seem to prefer JSON, which for just a couple things doesn't seem worth it, but for multiple layers of maps and lists starts making much more sense.

An alternative(that I've used in the past for different things) is using binary. When I did it, I think we didn't have buffers, so I was simply doing it "raw." For things like file formats with tons of numbers, this can make sense. Binary files are theoretically much faster than text(haven't tested so can't confirm). But in general they can hold much more data in less space when you are storing mostly numbers, so things like image files, 3d models, and similar data make perfect sense being binary. Note that technically, all files are binary, including text...its just the way they are read that is referred to when discussing binary vs. text files.
 

rob2d

Member
JSON is nice because you're able to import it into any number of software development environments/utilities to do work on it without needing to write a parser or things like MongoDB.
 

SpiredSix

Member
My little game GoosePuncher saves global data such as Highscores into a .ini file on the players pc.
On launch of game it reads the .ini files one by one and inserts the correct data from those files into the Highscores global data.
This is very interesting to see how others go about saving information.
:D
 

Yal

šŸ§ *penguin noises*
GMC Elder
I usually mostly have big arrays of data: flags, level-clear data, inventory item IDs, then save them in text files. Simple and extensible, and you don't need to worry about all those pesky format issues you get with binary files.
 
Top