Ax209
Member
Hey everyone. I'm looking for some advice, if anyone has any thoughts on this. It's regarding the best way to save info to a json/ds_map at multiple points of the game, and saving to different keys.
So, I think most of us came from saving to .ini files, right? I certainly did. A good thing about .ini saving, is that I could open the ini at any point, and save new information, and that would retain all of the previous information stored in there.
So I set up a really basic ds_map save/load system just to test if this could happen with json/maps. I saved information to variables 1, 2 and 3. I then loaded them from the json file and I could see them perfectly, just like the rest of the game. However when i went to save data for variables 4, 5 and 6 into the same file, although they loaded fine, I then tried to load data for variables 1, 2 and 3 and that data had disappeared.
My game saves different info at different points of the game, so for example at the end of each level, I save only the data I need and then load the next level, calling from the data on that file to tell me who was in the party, hp, gold etc. But I use a different save file as, say, the main controller's data. Or the unlocked chatacters to choose at the start of the game.
controllerdata.sav
characters.sav
endlevel.sav
and all of these are accessed at different times. Truth is, I've got about 15 different save files in my folder and it gets messy. Ideally I'd like to keep them all in a single save file. Is there any way I can access a map throughout the game, and only destroy it upon cleanup (end of level/room/game end)? Most tutorials say you have to destroy your map straight away.
What if there was a way I could open the map/file at the start of the game, and only destroy it when the game ends? So long as it was only being opened once and closed once, it should be that bad should it?
Or is there a way i can open a whole map from a json, change the data, and then save, but save ALL of the keys and their data, not just the ones I've used/written.
I'm sorry, I'm really still confused by ds_grids. I'm sure they're not confusing at all, but I have a very specific learning style and somethings, some things just throw me completely off. That's why it takes me forever to write the smallest piece of save code with ds_maps and json.
Many thanks in advance
Update: So playing around with seperate code than my game, I've realised that there is a way you can add to a json just by keeping the map open, then updating it and saving the file whenever needed.
I'm gonna try and clean everything up and implement a save system this way, by keeping a map open from the beginning till cleanup event. If someone replies with "OH NOOO, DON'T KEEP A MAP OPEN" then I'll change it, hahaha.
So, I think most of us came from saving to .ini files, right? I certainly did. A good thing about .ini saving, is that I could open the ini at any point, and save new information, and that would retain all of the previous information stored in there.
So I set up a really basic ds_map save/load system just to test if this could happen with json/maps. I saved information to variables 1, 2 and 3. I then loaded them from the json file and I could see them perfectly, just like the rest of the game. However when i went to save data for variables 4, 5 and 6 into the same file, although they loaded fine, I then tried to load data for variables 1, 2 and 3 and that data had disappeared.
My game saves different info at different points of the game, so for example at the end of each level, I save only the data I need and then load the next level, calling from the data on that file to tell me who was in the party, hp, gold etc. But I use a different save file as, say, the main controller's data. Or the unlocked chatacters to choose at the start of the game.
controllerdata.sav
characters.sav
endlevel.sav
and all of these are accessed at different times. Truth is, I've got about 15 different save files in my folder and it gets messy. Ideally I'd like to keep them all in a single save file. Is there any way I can access a map throughout the game, and only destroy it upon cleanup (end of level/room/game end)? Most tutorials say you have to destroy your map straight away.
What if there was a way I could open the map/file at the start of the game, and only destroy it when the game ends? So long as it was only being opened once and closed once, it should be that bad should it?
Or is there a way i can open a whole map from a json, change the data, and then save, but save ALL of the keys and their data, not just the ones I've used/written.
I'm sorry, I'm really still confused by ds_grids. I'm sure they're not confusing at all, but I have a very specific learning style and somethings, some things just throw me completely off. That's why it takes me forever to write the smallest piece of save code with ds_maps and json.
Many thanks in advance
Update: So playing around with seperate code than my game, I've realised that there is a way you can add to a json just by keeping the map open, then updating it and saving the file whenever needed.
I'm gonna try and clean everything up and implement a save system this way, by keeping a map open from the beginning till cleanup event. If someone replies with "OH NOOO, DON'T KEEP A MAP OPEN" then I'll change it, hahaha.
Last edited: