Game Services | Saved Games: Introduction

Saving game data is among the most desirable features of video games in general, and mobile games in particular. Nowadays, it's not uncommon for a user to own more than one mobile device, be it phone or tablet. Being able to start a game on one device, and then continue playing on another device without losing any progress brings a seamless - if not natural - user experience.

The Saved Games feature of Easy Mobile makes it possible - and easy - to save a player's game data to the cloud and synchronize it across multiple devices. Saving user data to the cloud also means that their game progression is preserved and can be restored in cases such as reinstallation or device failure.

On iOS, the game data is saved to iCloud via the Game Center (GameKit) API. On Android, it is saved to Google Drive via the Google Play Game Services API (GPGS).

Understanding Saved Games

A saved game consists of two parts:

  • An unstructured binary blob - this can represent whatever data you deem relevant to your game, and your game is responsible for generating and intepreting it.

  • Structured metadata - additional properties associated with the binary data and provide information about this data.

The table below describes common saved game properties.

Property Description
Name A developer-supplied short name of the saved game
ModificationDate A timestamp corresponding to the last modification of the saved game
DeviceName [iOS only] The name of the device that committed the saved game data
Description [GPGS only][Optional] A developer-supplied description of the saved game
CoverImageURL [GPGS only] [Optional] The URL of the PNG cover image of the saved game
TotalTimePlayed [GPGS only][Optional] A developer-supplied value (in milisesconds) representing the played time of the saved game
IsOpen Whether the saved game is "Open". A saved game can only be read or written to if it is open.

It's up to you to decide how and when users can save a game. Depending on your game design, you might want to allow only a single saved game, or you might want to allow the player to create multiple saved games with different names (so they can, for example, go back to various checkpoints and try different actions).

The Underlying Cloud Services

As mentioned earlier, saved games are stored on iCloud (iOS/Game Center) and Google Drive (Android/GPGS). Therefore, it's mandatory that the user has an iCloud or Google account to use the feature on the corresponding platform.

On iOS, the saved games are tied to the user's iCloud account, not the Game Center account.
On Android, the Google Drive associated with the user's Google account that was authenticated with GPGS is used.

Limitations

iOS (iCloud/Game Center) Android (Google Drive/GPGS)
No hard limit on the number of saved games No hard limit on the number of saved games
The size of a saved game data is limited to the amount of available space in the user's iCloud account) GPGS currently enforce size limits on binary data and cover image sizes of 3 MB and 800 KB respectively.

You should always strive to minimize the amount of data being saved. This prevents the user from running out of space and decreases the amount of time required to fetch or save a game file. Also note that the game saving operation may fail if there's not enough room in the iCloud or Google Drive account of the user.

Offline Support

Your game can still read and write to a saved game when the player's device is offline, but will not be able to sync with the cloud services until network connectivity is established. Once reconnected, the synchronization will be done automatically and asynchronously.

Conflict Resolution

When a user plays your game on multiple devices and uses the saved games feature, it's not uncommon to have multiple saved games with the same name and from different devices, thus creating conflicts. These conflicts typically occur when an instance of your game is unable to reach the cloud service while attempting to sync the save game data, or when it updates the saved game data on the cloud without loading the latest data first. In general, the best way to avoid data conflicts is to always load the latest data from the cloud service when your game starts up or resumes, and save data to the service with reasonable frequency. However, it is not always possible to avoid data conflicts. Your application should make every effort to handle conflicts to preserve users' data as well as maintain a good user experience. Fortunately, the Saved Games API can help you resolve these conflicts automatically using several default resolution strategies. It also provides relevant methods to help you implement your own resolution strategy to better suit your needs.

In this GameOn! - Saved Games In-Depth (Part 2) YouTube video by Google Developers you 'll find in-depth explanation on conflicts between saved games, how they happen, how to resolve them as well as other important concepts. The video is dedicated to the Saved Games feature of Google Play Games Services, but the concepts are also applicable to Game Center. A must watch.

  1. Saving A Game - Game Center Programming Guide
  2. Saved Games - Google Play Game Services
  3. GameOn! - Saved Games In-Depth (Part 2) YouTube video

results matching ""

    No results matching ""