Programming "Save game"

Started by
5 comments, last by Dirigible 15 years, 9 months ago
I've been mulling this over for a while now, and as I haven't done any programming for over a year now I haven't kept up what I learned in college. I never learned how to do this, but I've been wondering... What is the process for programming a game with a "Save game" function? I've always wondered how that works but never managed to dig it up.
Advertisement
sempiternal
basically take all the information you need to recreate the current state of the game and save it to a file.
I guess it depends on how you want to do it and what type of saving you're doing, such as save state, save point, or save wherever room/place you are and start from the beginning of that room/place.

I guess the way I would do it would be the last one. I would probably give a room or place a number value, and when the player wants to save, get that value and write it to a text file. Then, when the player wants to load, read the file and take it from there. But that's just how I would probably do it.
As Moonshoe said it depends of the game, if you have a real-time action games with quicksave everywhere and you want to save everything including enemies states and even the position of the snowflakes (ok maybe exaggerated) you need to serialize all you class. If you only have 2-3 things to save you can simply fill up a struct with the savegame data and write it to a file.
Ron Penton's Data Structures book has several examples including how to do quicksaves using bitvectors.
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe
Thank you all for the input. I'll definitely be reading up on the provided information and build a few test programs.

This topic is closed to new replies.

Advertisement