Saving or loading games and keyboard input with C++

As games get more and more complex and longer and longer, players will often need to play a game within multiple sessions. However, by default, players will need to start over from scratch. In this recipe, we will be going over how to save a variable and load it at runtime.

Getting ready

Before we start working on this, we need to have a project created and set up. Follow the Setting up your development environment recipe all the way to completion.

How to do it…

To give you an idea of how it works, let's do a simple example of saving a player's position and rotation, which we can return to using keyboard input:

  1. Navigate to File | New C++ Class, and you should see the Choose Parent Class window pop ...

Get Unreal Engine: Game Development from A to Z 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.