Making Steam Cloud Sync Work - Pelican-Party/steam-web-wrap GitHub Wiki
Steam has two main ways to make Steam Cloud work: The Steam Cloud API and Steam Auto-Cloud. At the moment, Steam Web Wrap only supports the latter, as there is no exposed api to access the Steamworks SDK yet.
Steam Web Wrap is built on top of Electron, which is built on top of Chromium. Since we are using browser storage APIs such as localStorage
or indexedDB
, we are limited to Chromium's folder structure for storing user session data.
This data is stored at the following paths:
- Windows:
%LOCALAPPDATA%\steam-web-wrap\games\<steam app id>\steam user id>\
- Linux:
~/.local/share/steam-web-wrap/games/<steam app id>/<steam user id>/
So now all that needs to be done is to let Steam know about these paths and it should automatically start syncing these files.
- First head over to the Application -> Steam Cloud tab.
- Then fill in the quotas at the top of the page, we set it to 10MB, but the limit depends on how much data you plan on storing.
- Then scroll to the bottom and click Save.
- Now you can fill in the paths for Steam Auto-Cloud. You could add the entire session directory here, but this will also include lots of cache files. For our game this directory easily exceeded the 10MB limit we set for ourselves. Instead we decided to only add the
IndexedDB
andLocal Storage
subdirectories, since those were the only storage APIs we were using for our game, but you can add as many paths as you like.
[!WARNING] Technically the Chromium team may make changes this folder structure in future updates. So normally you wouldn't want to rely on syncing only specific files of this directory.
For example, say the user installs your game to another device with Steam Cloud enabled. They would essentially start your game with only the
IndexedDB
andLocal Storage
subdirectories on their disk. Chromium does not make any guaranties that this setup is supported. It might depend on some extra file that you didn't sync for instance.However, we've found that this approach has worked fine so far in practice. Future breakage seems unlikely, and even if it were to break, you'll still be in control of when you release a new version of Steam Web Wrap to your users.
[!NOTE] Make sure to replace
12345
with your app id in these paths, you can find your app id in your browser's address bar of the current page.
{64BitSteamID}
will be replaced with the steam id of the user at runtime, you should leave this as is.
- Now that all paths have been added for Windows, we can add root overrides to make these files sync cross platform!
[!WARNING] Once again, syncing these files cross platform is not explicitly supported by Chromium. But so far everything seems to work fine, so we'll just roll with it.
-
If your game is already available to the public, you should check the Enable cloud support for developers only checkbox and test your changes. For new games you can skip this step.
-
That's it! You can save and publish your changes.