![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 21
Rep Power: 0
![]() |
Saving Progress
I was wondering how people let their programs save their progress. Like on a text-based rpg, how would I allow the player to save their game? I have an idea of what the answer might be, but please, help me out on this one. Please give me a detailed description of what to do if you can. Thx.
__________________
Kids, every year, more than 400,000 people die from tobacco chewing, smoking, an- MY GOD, HERE COMES A ZOMBIE PIRATE NINJA!!!!!! |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 378
Rep Power: 3
![]() |
What is your idea, we can tell you if it sucks or not. Depending on how complicated your game is you can just save some info to a text file, then read it back in when you start the game back up.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#3 |
|
Newbie
|
What is the reason for save a game that is 30 minutes long?
|
|
|
|
|
|
#4 |
|
Game engine designer
Join Date: May 2005
Location: Sweden
Posts: 309
Rep Power: 4
![]() |
An idea is to have a "GameState" class (or struct), where you store all things that you want to keep. And if everything in that class is static (no std::vector or std::string, just static arrays), it is very simple to write this class instance to a binary file, and then recreate it when you want to load your game.
This link might help you using binary files if you are not already familiar with it: http://www.cplusplus.com/doc/tutorial/files.html |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|