Hi there,
since i never made a mobile game i have no real experience how to do things the right/optimized way regarding performance, memory, read/write etc…
For instance, a game has lets say 5 worlds and each world has 600 levels. Now ofc i need to manage this data somewhow. This will contain things like level completion, level stars, level score, world completion, etc, all kind of stats.
What i have now is something like this(readability to me is not important, so only indexing) except i use 1 world = 1 file.
The file with 5 worlds a 600 levels is ~ 210K in filesize:
1 = -- world 1
{
1 = {0,0,0,0}, -- level 1 {score,stars,..}
2 = {0,0,0,0}, -- level 2
3 = .... -- level 3
},
2 = -- world 2
{
1 = {0,0,0,0}, -- level 1 {score,stars,..}
2 = {0,0,0,0}, -- level 2
3 = .... -- level 3
},
3 = -- world 3
{...}
So, what i want to know here
- Is it ok to save all the data in one file like above or should i better leave it at 1 world = 1 file?
- Can i load the file at the start of the game, keep it always in memory and do my read/write as needed? Or should i load/unload it everytime i need it? More than one screen will access the data.
- Is it good to use the simple
sys.save
andsys.load
to handle this data? Maybe they are better ones?
I welcome anyone to share his experience.