Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   how to save... (http://www.go4expert.com/forums/how-to-save-t15554/)

cpulocksmith 20Dec2008 12:50

how to save...
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...

neo_vi 20Dec2008 14:48

Re: how to save...


Hope this helps

cpulocksmith 21Dec2008 01:36

Re: how to save...
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 21Dec2008 08:09

Re: how to save...
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.

All times are GMT +5.5. The time now is 00:25.