Advertisement

Save Feature in a RPG

Started by December 01, 1999 04:59 PM
1 comment, last by GameDev.net 25 years ago
Saved games... hmmm... I am assuming you can write to external files (otherwise I can't help without knowing what you're coding in).

You already know the format of all your ingame data. Take a piece of paper and a pencil and write down ALL the stuff you want to be saved, so that when the game is loaded you can restore everything you have to. Don't bother saving anything constant, its a waste of filespace.

The most crucial thing to remember is the format and ORDER you save things in. You don't want to load your inventory data into the character attributes by mistake, that would be interesting.

Stuff like compression and encrypting your data files is a little advanced, I'd suggest you leave them until you have a working beta-test.

Hi. We are making a RPG/Stratergy we have done some of it but we dont know how to make a save function, so the player can save his progress in a game. Please someone help us! Any suggestions please post to chris@matrix7.fsnet.co.uk. Any help would be very much appreciated.
Advertisement
Well, I designed for this from the start, and to me the most important aspect was to seperate the static and non-static game data.
for example, you usually have some or all parts of a map which don't change within the game which don't need to be saved, but things like locations of characters and items do.

I do this by having seperate lists(or arrays) for all my non-static data. One for people, one for items, one for doors, one for events, etc....

create your save function first, just loop throught each of the non-static lists writing to disk. I use the basic c++ services for this iofile.h etc...

simple copy the save function to the load function, add code to clear out all the lists at the beginning, then replace your writes with reads, and add code to allocate memory before the reads if necessary.
You also need to add code to load the non-static parts of the game, usually the base map data.

The only difficulty is setting up dealing with the new or default situation, i.e. starting a game with a clean slate, I simply treat it as a special case and load the infomation from a different place in the newgame routine, otherwise I load it from the savegames.

Some games use a different technique and store only data that has changed, which leads to smaller save games at the beginning, but at least as large at the end, and unless its necessary for some reason, I think adds needless complexity.

hope this helps.

mat williams
zero sum software www.zero-sum.com

This topic is closed to new replies.

Advertisement