Skip to content

Xbox – Knowledge: Save Game Behavior

You are here:
Estimated reading time: 1 min

Save Game Behavior

Save and Load Flow

Here we will provide some examples of how saving is done on Xbox and some loading processes as well. This process involves some platform functions that have callbacks for information related to the process. Saves data to the specified blob (file) within the specified container.

For the save to make sense, it is necessary to consider a few things:

  • Player Identification: The player needs to be logged into a Microsoft account to use Xbox Live. You can utilize the Xbox Live SDK to authenticate the player and retrieve their Gamertag.
  • Serialization and Deserialization: Convert the game data into a format that can be easily saved and loaded. Typically, this involves serializing the data into a format such as JSON or XML. You will also need methods to deserialize this data back into game objects.
  • Player Feedback: Provide feedback to the player to indicate that the game data has been successfully saved. This can be done by displaying a message on the screen or using other forms of visual or auditory feedback.

We need to pass the information to be saved as a byte array to a function called “Save.” For our example, we created a script called “gkd.cs,” where we centralize this information. The save function looks like this:

You can read the official documentation for this function here.

The load system also does something very similar but in reverse, retrieving the previously saved information.

You can read the official documentation for this function here.

Right below, you can also observe some other callbacks that comprise the structure of calls for the save and load system.

Data Type Overview

Xbox Live Services uses a variety of data types related to identity and authentication. These articles provide an overview of those types.

You can consult the complete documentation for saving in the official documentation by clicking here. In it, you can learn about best practices, details about each function and property related to saving, and their roles within the code. We strongly recommend reading this section as it contains crucial information about the structure and implementation of game saves.

Attachments

Was this article helpful?
Dislike 0
Views: 16
Back To Top