how to save...

cpulocksmith's Avatar, Join Date: Jul 2008
Skilled contributor
ok well, i have a question. as some of you may know i am trying to make a dungeon like text based game in c++. and so far it is going along quite will, with help from the fine people at this site. but i have one question that i think is going to be a pain. how would i save a game. i really have no idea how to save a game so that you could come back to it latter and you would be at the same position and have the same stats and items. since i realy have no idea and i have search the internet for the answer and fail i now turn to you people to point me in the correct direction. and i feel that i am not going to like the next little peace of code i am going to have to write with this new info i hope you can provide me.

thanks locksmith...
cpulocksmith's Avatar, Join Date: Jul 2008
Skilled contributor
well i went through both of those links you gave and i did find some stuff useful but i still really dont know what it is i am supposed to do. if it helps any i am using a unix and not windows.
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Just write whatever information you feel is necessary to a file, and include in the program the logic to read that file and restart the player from a specific point in the game rather than at the beginning.

Tip: Write it out in text format first, then it's easy to read and to edit. Binary files can be a pain but once you've got it sorted you can switch to a binary format if you like.
Tip 2: sort out the file read logic first, using hand-crafted savegame files. Once you know what you need in the file you can then write the file write logic.