The Saved Games service gives you a convenient way to save your players' game progression to Google's servers. Your game can retrieve the saved game data to allow returning players to continue a game at their last save point from any device.
The Saved Games service makes it possible to synchronize a player's game data across multiple devices. For example, if you have a game that runs on Android, you can use the Saved Games service to allow a player to start a game on their Android phone, and then continue playing on a tablet without losing any of their progress. This service can also be used to ensure that a player's game play continues from where it left off even if their device is lost, destroyed, or traded in for a newer model.
To learn how to implement saved games for your platform, see Client implementations.
Saved Games basics
A saved game consists of two parts:
- An unstructured binary blob - this data can represent whatever you choose, and your game is responsible for parsing and writing to it.
- Structured metadata - additional properties associated with the binary data that allow Google Play games services to visually present Saved Games in the default Saved Games list user interface (UI), and to present useful information in the Google Play Games app (for example, last updated timestamp).
A game can write an arbitrary number of Saved Games for a single player, subject to user quota, so there is no hard requirement to restrict players to a single save file.
The Saved Games service provides a visual user experience in addition to persistence features. You are strongly encouraged to associate representative images with corresponding save files. If you are using the default Saved Games list user interface (UI) provides by the Play Games SDK in your game, the UI will display these cover images. The cover images may also appear in the Google Play Games app.
You can provide a short text description of the content of a particular saved game. This description is directly displayed to players and should summarize the state that the saved game represents; for example, “Fighting the Goblins in the Dark Woods”.
Developers are not charged for any saved game data that’s stored in the cloud. Instead, this data is counted against the player’s Google Drive quota - you never have to worry about it. The only quota that game developers need to care about is their Google Drive API quota
All Saved Games are stored in your players' Google Drive Application Data Folder. This folder can only be read and written by your game - it cannot be viewed or modified by other developers’ games, so there is additional protection against data corruption. In addition, Saved Games are insulated from direct tampering by players so they cannot modify individual Saved Games.
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 Google Play games services until network connectivity is established. Once reconnected, Google Play games services asynchronously updates the saved game data on Google's servers.
When using the Saved Games service, your game may encounter conflicts when attempting to save data. These conflicts can occur when a user is running more than one instance of your application on different devices or computers. Your application must be able to resolve these conflicts in a way that provides the best user experience.
Typically, data conflicts occur when an instance of your application is unable to reach the Saved Games service while attempting to load data or save it. In general, the best way to avoid data conflicts is to always load the latest data from the service when your application 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 such that your users' data is preserved and that they have a good experience.
Google Play games services currently enforce size limits on binary data and cover image sizes of 3 MB and 800 KB respectively.
Saved game metadata
The structured metadata for a saved game contains these these properties:
|ID||A unique string generated by Google Play games services for this saved game. Use this ID to refer to the saved game in your game clients.|
|Name||A developer-supplied short name for the saved game, for example "Save slot 1" or "PlayerName_Save1". This is not shown to players.|
|Description||A developer-supplied description of the saved game. The description is displayed to players in the Google Play Games app and the saved game list UI.|
|Last modified||Timestamp in milliseconds generated by Google Play games services for when the saved game was last updated.|
|Played time||A developer-supplied time (in milliseconds) to display on the saved game. This value should represent how long the player has played the corresponding save game. For example, a played time value of 3600000 will be displayed by Google Play games services as "1 hr".|
|Cover image||This is an optional, developer-supplied property that contains information about the cover image.|
To learn how to implement Saved Games for your platform, see the following resources: