Chapter 24
Using File IO to Save and Load Games
Saving and loading game progress is a standard feature of all but the most basic games today. This means that you will need to know how to handle the loading and saving of game objects. This chapter covers one possible strategy for writing out the data you will need to be able to reinstate a player’s game.
First we look at the SerializationManager class, which uses the STL classes ifstream and ofstream to read and write from files. Then we cover how to update the Text Adventure game to be able to save which room the player is in, which items have been picked up, which enemies are dead, and which dynamic options have been removed.
What Is Serialization?
It would be good to cover what serialization ...
Get Learn C++ for Game Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.