O'Reilly logo

C++ Game Development Primer by Bruce Sutherland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    3

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required