Jump to content
  • Advertisement
Sign in to follow this  
yurian

How do I make a save file?

This topic is 3741 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!