storing save data

Started by
2 comments, last by foofightr 24 years ago
i haven''t implemented this yet, but i''ve given it some thought. this is for a typical FF2 style RPG -> single player, tile based, etc.. the problem seems to be the method used to store maps that have changed. i am using external map files of course. one way is to store the changes right back in the file whenever the game is saved. this has the advantage of being straight forward, since your copy of the map file is always up to date. but this has the effect of "destroying" the original copy, since you''re saving over the one and only map file. you have no way of "restoring" the original map. a second way would be to NOT alter the map file, but store a list of "changes" that have taken place. this has the advantage of keeping the original map intact, so that if the player starts a new game from scratch, you just get rid of the "changes" file, and everything is back to square one. but, the big drawback is that all throughout the rendering loop, you need to check the changes file all the time for which stuff to draw (ok, maybe not ALL the time, but way too often). maybe a third way is a mix of the first two, which is to have two copies of each map, one original and one "up to date". This uses more disk space, has a lot of redundant info, but is quite convenient. i keep thinking back to how they did this in the old NES games (like FF1), and the only method i can think of that they used is to, of course, hard-code the maps in the executable (duh) and have several boolean flags that indicate whether certain goals/actions have been achieved or not. like "talked_to_wise_man = 1", "killed_level_boss = 0" and so on. and when you re-start a game, these boolean values are just re-initialized to their default values. so in essence, the maps are 99% static with a few on/off switches. this is acceptable for old cartridge games, but totally not acceptable for modern games, or at least the one im trying to make. does anyone have more decisive info on how the old NES ROMS worked with map data? or maybe im missing the boat completely here? whats the ideal way to save game data and have it easily "re-initialized"?
Advertisement
I think that in 99% of games, the ''map'' stays the same, it is the character positions that are changed. Separate in your design everything that stays the same from everything that can change. Then you may want to consider saving everything that can change and loading that on top of the static data each time. It seems like overkill but it will be compact and simple enough most of the time.
I think the easiest way would be to have a default map
loaded each time you run the game. In saved games, save the alterations to the map in the save file, and load them into the data structure when loading the game
thanks for the suggestions, gang

i do distinguish static and dynamic parts of the map, so it''s already in place. i guess the best way is to keep the original map file intact at all times, and just save the dynamic parts of the map in a separate save file. and when it comes time to load the save game, i use the parameters for the dynamic parts in the save file rather than in the original map, so really it doesn''t cause any slow down, because what''s in memory is what''s up to date.

i''ll let you know how it turns out

This topic is closed to new replies.

Advertisement