Sign in to follow this  
yurian

How do I make a save file?

Recommended Posts

I'm wondering how to make a file that my program can read to pick up where the game left off. I am using Allegro and C++ Example: Start game, choose New Game or Continue Game. I want game to remember variables such as map, saveroomid, has_so_and_so_weapon_unlocked, defeated_whatever_boss... Please help me! ^__^

Share this post


Link to post
Share on other sites
Well, first you should learn how to do file I/O if you haven't already. Then, decide on a format for the file (in this case, what to save, and in what orderr). Then its a matter of writing these values to a file in the given order with something left in there to deliminate where one value ends and the next begins. Loading them is a matter of reading in up to each deliminator and copying the value into the appropriate variable in the right order.


This is a very simple version of a very limited method, I don't have time to write too much more, hopefully it will help.

Share this post


Link to post
Share on other sites
Generally your game will have state variables and such, a really simple way, is to simply write all that data to file, then to load, just read it in the same order assigning them to the variables state variables.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this