No-code cloud saves for PC
Some games getting ported to PC Game Pass may require a no-code cloud save solution. Good examples of this include the following:
- Game is x86 and can't directly consume the GDK outside of packaging
- Game might have been created without developers using something similar to Blueprint with Unreal or Bolt with Unity
Using no-code cloud saves, games just read and write from their desired save directory, using the standard Win32 file IO APIs, and synchronization will be handled automatically. Games do not need to write special code to handle the synchronization and upload. Synchronization will happen prior to the game launch.
No-code cloud saves get uploaded when the game on PC is no longer active. Upload will happen when:
- Game is terminated
- User whose saves are getting tracked is signed out
- Power state change happens on PC
- 30 minutes have elapsed where either the game is in the background or the game hasn't done any new writes to the designated save area
The no-code cloud save solution is built on top of XGameSaveFiles and shares all of those limitations with respect to file sizes and per-user storage limits. Files are limited to 64 MB (or 16 MB if there is need to have interoperation between XGameSave or Connected Storage). By default, the storage per-user is limited to 256 MB. Games needing larger per-user storage limits can work with their DPM to request an exception.
Note
There are specific naming conventions and character limits for directories and file names. For more information see XGameSaveFiles
No-code cloud saves are only supported on PC. It requires that the game must have also opted into the simplified user model (NDA topic)Authorization required to ensure that a user is always signed in prior to the game launch. If a user can't be signed in for the game, the game will not be allowed to launch. If the user is signed out during game play, the game will get terminated.
Enabling no-code cloud saves
To enable no-code cloud saves, developers need to modify their microsoftgame.config. They must enable the simplified user model, specify the root folder that they expect the save files to get written to and read from, and provide the game's corresponding SCID.
<Game configVersion="1">
<Identity Name="SampleNameOne" Publisher="CN=NoPublisher"/>
<SaveGameStorage>
<NoCodePCRoot RelativeTo="SavedGames">test\path</NoCodePCRoot>
<SCID>DF9D8061-4790-4B84-86B4-CD060B00B4DD</SCID>
<MaxUserQuota>256</MaxUserQuota>
</SaveGameStorage>
<!-- much content removed -->
<!-- Must also opt into requiring a default user at launch -->
<AdvancedUserModel>false</AdvancedUserModel>
</Game>
The root folder specified by NoCodePCRoot must be relative to one of a small collection of options.
RelativeTo | Folder location on PC |
---|---|
AppData | Maps to the environment variable %APPDATA% |
Public | Maps to the environment variable %PUBLIC% |
LocalAppData | Maps to the environment variable %LOCALAPPDATA% |
LocalAppDataLow | Maps to %USERPROFILE%\AppData\LocalLow |
ProgramData | Maps to the environment variable %PROGAMDATA% |
SavedGames | Maps to %USERPROFILE%\Saved Games |
UserProfile | Maps to the environment variable %USERPROFILE% |
Files cannot be placed directly in the root directory. They must be nested within at least one subfolder from the root folder. For example, using a filename directly, such as <NoCodePCRoot RelativeTo="SavedGames">savegame1.sav</NoCodePCRoot>
, would be invalid because savegame1.sav would be ignored. <NoCodePCRoot>
is intended to define a directory path, not a specific file.