How to Force a Game on Steam to Upload Cloud Save Files

In Brief

Steam Cloud automatically stores files from your game on Steam's servers so your players tin log into Steam and access their saved games from whatever computer.

Level of integration

Configuration of file paths required on Steamworks website. Optionally, some API calls required from within game code to Steamworks for upload, download, enumerate, and delete.

Steam Cloud Overview

The Steam Cloud provides an piece of cake and transparent remote file storage system for your game. Files specified in the Auto-Deject configuration or written to disk (created, modified, deleted, etc.) using the Cloud API volition automatically be replicated to the Steam servers afterward the game exits.

If the user changes computers, the files are automatically downloaded to the new computer prior to the game launching. The game tin can then access the files by reading them through the Cloud API or reading them direct from disk as usual. Avoid machine specific configurations such equally video settings.

The Steam Client does the work of ensuring that the files are kept synchronized across all computers the user may be accessing.

Users tin can globally disable Deject synchronization in the Steam Settings under Deject by unchecking "Enable Steam Cloud synchronization for applications which support information technology."

Users can also disable the Cloud synchronization on a per game footing in each games properties.

Spacewar_Cloud_Properties.png

Notes and All-time Practices

Information technology is of import to recollect that Steam will synchronize the user's Steam Deject files for your game before and later every session. Whatsoever matching files which change during the session will be uploaded to Deject storage immediately after. If your game writes very large files, or many modest files, to Steam Cloud, then this may cause a noticeable affect on the user's internet bandwidth and also filibuster their ability to shut down Steam or re-launch the game.

As a full general rule, smaller files will work meliorate. If the saved country for a given user can exist separate into different categories - things which may alter frequently, and things which may not modify often - then nosotros recommend using separate files for those categories. That style, the un-inverse state will not be re-uploaded after every session.

File Size Limits

The accented limits on file sizes for Steam Cloud may modify over time. Here are some current limits and thresholds:

Size Brake
100MB Maximum size for a telephone call to ISteamRemoteStorage::FileWrite or ISteamRemoteStorage::FileWriteStreamWriteChunk
256MB May result in a non-optimal storage endpoint pick for the user'due south location, negatively impacting upload/download operation

Salve File Paths

When deciding where to write your save files, be sure the path will be unique for the current Steam user. If needed, y'all can get the user's unique Steam ID via ISteamUser::GetSteamID. From that, you lot can admission their accountID from GetAccountID(), assuasive you to have a unique variable when amalgam your salve path.

Cantankerous-Platform Saves

If your game is supported on multiple platforms - or even if you programme to back up this in the hereafter - you should consider this when setting up Steam Cloud for your game.

If yous plan to read/write files directly via the ISteamRemoteStorage interface, then you can command platform sync via ISteamRemoteStorage::SetSyncPlatforms. The default for a new file is to sync to all platforms.

If y'all plan to utilise Steam Auto-Cloud, there are some cardinal things to know. Commencement, the default for new files is to sync to only the Os setting on the associated Auto Cloud Root path. This means that if you set upwardly distinct roots for each OS, all files will be partitioned by platform, and hence there will be no cross-platform relieve functionality.

To enable cross-platform saves, yous should instead define a single Root path (likely for Windows), and then create Root Overrides for the other supported platforms. Files matching a given Root path which also has platform Root Overrides will sync to all platforms in both the origianal Root and all Overrides. See the Steam Motorcar-Cloud documentation for more details.

Initial Setup

To fix Steam Cloud yous must gear up the Byte quota per user and Number of files allowed per user options on the Steam Deject Settings page in the Steamworks App Admin panel.

This quota is enforced on each Cloud-enabled game, on a per-user-per-game footing. Information technology's recommended to set the values to reasonable amounts for your game championship.

Notation: Don't forget to click Save at the bottom of the folio, and Publish your updated settings. Once published the deject icon will be visible in the Steam client for anyone that owns your game.

If your game has already been released to the public and then you can check the box labeled Enable cloud back up for developers only. If developers-only mode is enabled then only the steam accounts which own a "Programmer Comp" license for your championship will come across the cloud icon and will exist able to apply the Steam Deject. This is useful to safely test Steam Cloud integration without breaking the public user experience. This has no effect on unreleased games since no ane owns the game however, they won't exist able to see or access any cloud storage for the specific app ID.

You are able to share Cloud storage space betwixt ii app IDs by filling out the Shared cloud APP ID field. This is virtually commonly used to share saved games between a demo and a full game. A value of 0 disables this feature.

Steam Deject API and Steam Auto-Cloud

Steam provides two different methods of utilizing the Steam Cloud, read up on how the two methods differ, and determine which would exist the best for your awarding.

Outset up is the Steam Cloud API.
The Deject API provides a series of functions which allows you lot to directly integrate the Steam Cloud into your game. The Cloud API isolates individual Steam users files from each other and provides a greater level of control over the Steam Cloud.

The Steam Cloud API is exposed via the ISteamRemoteStorage API interface, and you tin find case usage in the Steamworks API Example Application (SpaceWar) project.

The second is Steam Auto-Cloud.
Steam Machine-Cloud was designed for games where yous cull to non integrate the Steam Cloud API. It provides a quick and easy fashion to get started but lacks the flexibility that is bachelor with the Steam Cloud API.

If yous prefer a deeper integration with Steam Cloud (for example, allowing to cull which salve files are stored in the cloud), then you should use the Cloud API. Otherwise yous can apply Steam Machine-Cloud.

Steam Auto-Cloud

Steam Auto-Cloud is an culling to the Steam Cloud API that allows apps to apply Steam Deject without writing code or modifying the game in any way. It only requires that you lot specify the file groups which you want persisted to the Cloud. Steam volition automatically sync the groups of files when the awarding launches and exits. Avert motorcar specific configurations such every bit video quality.

Annotation: The file steam_autocloud.vdf will exist created in each location specified by your Steamworks deject paths. This file is used by Steam, and can be ignored past your game.

Setup

After completing the Initial Setup the Steam Auto-Cloud configuration section will unlock on the Steam Cloud Settings page.

Root Paths describe groups of files which volition be persisted to the Steam Cloud. Each Root Path can be as specific as a single file or as wide as all files under a given subfolder. Apply a new path for each group of files to sync.

A Root Path is composed of 5 parts:

  1. Root

    This is a pre-adamant list of paths where game saves are commonly located.
    Root Supported OSes Corresponding Path
    App Install Directory All [Steam Install]\SteamApps\common\[Game Folder]\
    SteamCloudDocuments All Platform specific path, e.g. on Linux: ~/.SteamCloud/[username]/[Game Folder]/
    WinMyDocuments Windows %USERPROFILE%\My Documents\
    WinAppDataLocal Windows %USERPROFILE%\AppData\Local\
    WinAppDataLocalLow Windows %USERPROFILE%\AppData\LocalLow\
    WinAppDataRoaming Windows %USERPROFILE%\AppData\Roaming\
    WinSavedGames Windows %USERPROFILE%\Saved Games\
    MacHome macOS ~/
    MacAppSupport macOS ~/Library/Application Support/
    MacDocuments macOS ~/Documents/
    LinuxHome Linux ~/
    LinuxXdgDataHome Linux $XDG\_DATA\_HOME/
  2. Subdirectory

    Subdirectory path to the clouded files relative to the Root. Employ `.` if there is no subdirectory.

    Auto-Deject special path values
    Motorcar-Deject allows the use of unique Steam user identifiers in the Subdirectory path. This allows you to store save files for each Steam user on the computer separately. You can use ISteamUser::GetSteamID in your game to get the current users SteamID or AccountID to save to and read from.

    • {64BitSteamID} - Use this variable in the steam path to insert the users 64bit Steam ID. A 64 bit Steam ID looks like: 76561198027391269
    • {Steam3AccountID} - Use this variable in the steam path to insert the users Steam 3 Account ID. An Account ID looks similar: 67125541
    Example: SavesDir/{64BitSteamID}
  3. Pattern

    File mask pattern to match. Yous can use * every bit a wildcard. If y'all want all files in the directory, just utilize *.

    Example: *.sav

  4. OS

    Sets the Operating Systems that these files will be synced from/to. This is only required if the files are OS specific, which is hopefully not the example!
  5. Recursive

    Include sub-directories when searching for matching files. This is useful for sub-directories with non-deterministic names such equally non-steam user names or IDs. If it'due south using a Steam ID, then using the special path values in the Subdirectory field is highly recommended.

Root Overrides

If your awarding is cross-platform and requires different directories for each Bone. You can use the Root Overrides functionality to specify an override the Root Paths that yous set above.

The root paths specified above can be overridden to correspond to a dissimilar path on another OS. If you apply Root Overrides, you must specify [All OSes] in the Root Os drop down above.

A Root Override consists of 5 parts.

  1. Original Root

    This corresponds to one of the Roots that you set above.
  2. Os

    The Operating System to utilise the override on.
  3. New Root

    The new location that the Original Root maps to on the specified OS.
  4. Add together/Supervene upon Path

    This allows y'all to optionally add a subdirectory path which is inserted between the new root and the original subdirectory.
  5. Replace Path

    If enabled, information technology causes the path specified in Add/Replace Path to supercede the original subdirectory entirely.

Example: Configuring Auto-Deject for Unity Applications

The post-obit is an example of setting up Auto-Deject for use with Unity and the Application.persistentDataPath property where the value is different per Os. The Windows version is configured as the Root Path with the company in Unity set to DefaultCompany and the Project called AutocloudSample. On macOS and Linux/SteamOS, the alternate paths from Application.persistentDataPath are set in the Add/Supercede Path field and Replace Path is enabled.

With these settings, Auto-Cloud files will be synchronized betwixt the three folders as shown in the Preview samples.

Cloud_Unity_Auto-Cloud_Example.png

Pre-release Testing

If you are calculation Steam Auto-Cloud to a game which is already released and you have enabled programmer-just mode during the Initial Setup then you lot must complete some additional steps to exam the functionality.

  1. Sign in to Steam with an account that owns the app that you are testing.
  2. Open the Steam Panel by navigating to steam://open/panel in your browser.
  3. Enter testappcloudpaths <AppId> into the console with the given App ID that you are testing. Ex: testappcloudpaths 480
  4. Enter set_spew_level 4 four into the panel.
  5. Launch your app from Steam.
  6. Check the console for activity, If files already exist in the Auto-Cloud paths then you should see them being uploaded. Otherwise save some files from your app and so close it to trigger a sync.
  7. Go to another PC and echo the steps above to test downloading the files from Steam Auto-Cloud.
  8. Be sure to exam on all supported operating systems.
  9. Set testappcloudpaths 0 and set_spew_level 0 0 to cease testing. You can restart the Steam client to get rid of the console tab.

Don't forget to disable developers-only mode and publish the changes when you're done testing.

Dynamic Cloud Sync

Steam Cloud now supports dynamic sync - where changes appearing in the Deject can be downloaded to the local machine during an application session. The electric current example is a suspended game session on the Steam Deck. For apps marked as supporting dynamic Cloud sync, Steam will synchronize files upwardly to the Steam Deject at the suspend fourth dimension. Then, the user may run the game on some other device, which will receive the updates from the Steam Deck session at launch. At exit, those changes volition be uploaded to the Steam Cloud. Finally, when the Steam Deck device is awakened, Steam volition synchronize the changes down to that device, and mail service a notification to the application that local files have changed. The awarding can then iterate those changes and take advisable activity. For instance, the game may exist able to simply load the updated progress from deejay and let the user to selection up right where they left off on the other device.

Check out our announcement postal service for even more information virtually why this feature exists, and how to utilize it.

Notation that this characteristic supports applications whether they apply the ISteamRemoteStorage API to manage files, or Auto-Deject.

For more details, see the ISteamRemoteStorage documentation, specifically ISteamRemoteStorage::RemoteStorageLocalFileChange_t, ISteamRemoteStorage::GetLocalFileChangeCount, and ISteamRemoteStorage::GetLocalFileChange.

See also ISteamRemoteStorage::BeginFileWriteBatch and ISteamRemoteStorage::EndFileWriteBatch - these wrappers should be used to provide hints to Steam which will help it safely sync up to the Steam Cloud at the fourth dimension when the user initiates a system suspend.

Pre-release Testing

Yous can locally enable Dynamic Cloud Sync for your app to test your builds - this is recommended for a game that has already shipped, equally enabling Dynamic Cloud Sync for all users could lead to information loss when running builds that do not handle the new API methods and callbacks.

To test locally from a PC:

  1. Sign in to Steam with an account that owns the app that you are testing.
  2. Open the Steam Console by navigating to steam://open/console in your browser. (You lot can also run Steam with the command-line steam -panel and then navigate to the Console section directly).
  3. Enter @cloud_testdynamicsyncapp <AppId> into the console with the given App ID that you lot are testing. Ex: @cloud_testdynamicsyncapp 480
  4. Launch your app from Steam.
  5. Progress through the game to a desired amount
  6. In the Steam Console, enter prepare_for_suspend. Steam will suspend your game process and upload any changed files to the Steam Deject.
  7. Optional: play the game on another device, creating farther progress, then exit and let that Steam client upload progress to the Steam Cloud.
  8. Back on the original device, in the Steam Console, enter resume_suspended_games. This will sync down any necessary files from the Steam Cloud, post the relevant API calls to your game, then un-suspend your game process.

To test locally from a Steam Deck:

  1. Connect your Steam Deck with a Devkit
  2. To employ the CEF Panel, see here
  3. In the JS panel, enter SteamClient.Panel.ExecCommand("@cloud_testdynamicsyncapp <AppId>") to enable testing. You can and then enter SteamClient.Console.ExecCommand("@cloud_testdynamicsyncapp 0") to disable it

Debugging

First, ever ensure that y'all have published your changes on the Steam partner website and take waited up to ten minutes or restarted your Steam client to receive the published changes.

If you run into issues with Steam Cloud yous should check the log file located at %Steam Install%\logs\cloud_log.txt.

See Debugging the Steamworks API for additional information.

hartsocktrainsomill1963.blogspot.com

Source: https://partner.steamgames.com/doc/features/cloud

0 Response to "How to Force a Game on Steam to Upload Cloud Save Files"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel