Steamworks-dokumentation
Steam Cloud
Kort opsummering
Steam Cloud gemmer automatisk filer fra dit spil på Steams servere, så spillere kan logge på Steam og tilgå deres gemte filer fra en hvilken som helst computer.
Integrering
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.

Oversigt over Steam Cloud

Steam Cloud giver et simpelt og overskueligt system til ekstern lagring af filer til dit spil. Filer, der er angivet i Auto-Cloud-konfigurationen eller er skrevet til disken (oprettet, ændret, slettet osv.) med Cloud-API'en, kopieres automatisk til Steam-serverne, når spillet forlades.

Hvis brugeren skifter til en anden computer, downloades filerne automatisk til den nye computer, inden spillet startes. Spillet kan derefter tilgå filerne ved at læse dem via Cloud-API'en eller læse dem direkte fra disken som sædvanligt. Undgå maskinspecifikke konfigurationer såsom videoindstillinger.

Steam-klienten sørger for, at filerne altid er synkroniserede på tværs af alle computere, som brugeren benytter.

Brugere kan slå Cloud-synkronisering fra globalt i Steam-indstillingerne under "Cloud" ved at fjerne markeringen i "Slå Steam Cloud-synkronisering til i applikationer, som understøtter det".

Brugere kan også slå Cloud-synkronisering fra for individuelle spil i egenskaberne i hvert spil.

Spacewar_Cloud_Properties.png

Notes and Best Practices


It is important to remember that Steam will synchronize the user's Steam Cloud files for your game before and after every session. Any matching files which change during the session will be uploaded to Cloud storage immediately afterward. If your game writes very large files, or many small files, to Steam Cloud, then this may cause a noticeable impact on the user's internet bandwidth and also delay their ability to shut down Steam or re-launch the game.

As a general rule, smaller files will work better. If the saved state for a given user can be split up into different categories - things which may change frequently, and things which may not change often - then we recommend using separate files for those categories. That way, the un-changed state will not be re-uploaded after every session.

File Size Limits


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

SizeRestriction
100MBMaximum size for a call to ISteamRemoteStorage::FileWrite or ISteamRemoteStorage:;FileWriteStreamWriteChunk
256MBMay result in a non-optimal storage endpoint choice for the user's location, negatively impacting upload/download performance

Initial Setup

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

This quota is enforced on each Cloud-enabled game, on a per-user-per-game basis. It's recommended to set the values to reasonable amounts for your game title.

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

If your game has already been released to the public then you can check the box labeled Enable cloud support for developers only. If developers-only mode is enabled then only the steam accounts which own a "Developer Comp" license for your title will see the cloud icon and will be able to use the Steam Cloud. This is useful to safely test Steam Cloud integration without breaking the public user experience. This has no effect on unreleased games since no one owns the game yet, they won't be able to see or access any cloud storage for the specific app ID.

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

Steam Cloud 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 be the best for your application.

First up is the Steam Cloud API.
The Cloud API provides a series of functions which allows you 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 can find example usage in the Steamworks-API-eksempel på applikation (SpaceWar) project.

The second is Steam Auto-Cloud.
Steam Auto-Cloud was designed for legacy games where you can not easily integrate the Steam Cloud API. It provides a quick and easy way to get started but lacks the power and flexibility that is available with the Steam Cloud API.

It is generally recommended that you use the Cloud API if possible as it allows for deeper integration and customization, and it enables you to best provide the high quality experience that Steam users have come to expect from the Steam Cloud.

Steam Auto-Cloud

Steam Auto-Cloud is an alternative to the Steam Cloud API that allows apps to use Steam Cloud without writing code or modifying the game in any way. It only requires that you specify the file groups which you want persisted to the Cloud. Steam will automatically sync the groups of files when the application launches and exits. Avoid machine specific configurations such as video quality.

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 will 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. Use a new path for each group of files to sync.

A Root Path is composed of 5 parts:
  1. Rod

    Dette er en forudbestemt liste over stier, hvor gemte spil almindeligvis findes.
    RodUnderstøttede OS'erTilsvarende sti
    Applikationens installationsmappeAlle[Steam Install]\SteamApps\common\[Game Folder]\
    SteamCloudDocumentsAllePlatformsspecifik stil, for eksempel på Linux: ~/.SteamCloud/[username]/[spilmappe]/
    WinMyDocumentsWindows%USERPROFILE%\Dokumenter\
    WinAppDataLocalWindows%USERPROFILE%\AppData\Local\
    WinAppDataLocalLowWindows%USERPROFILE%\AppData\LocalLow\
    WinAppDataRoamingWindows%USERPROFILE%\AppData\Roaming\
    WinSavedGamesWindows%USERPROFILE%\Saved Games\
    MacHomemacOS~/
    MacAppSupportmacOS~/Library/Application Support/
    MacDocumentsmacOS~/Documents/
    LinuxHomeLinux~/
    LinuxXdgDataHomeLinux$XDG\_DATA\_HOME/
  2. Undermappe

    Undermappestien til filerne i skyen i forhold til roden. Brug ".", hvis der ikke er en undermappe.

    Særlige stiværdier i Auto-Cloud
    Auto-Cloud giver mulighed for at bruge unikke ID'er for Steam-brugere i Undermappe-stien. På denne måde kan du lagre gemte filer separat for hver Steam-bruger på computeren. Du kan bruge ISteamUser::GetSteamID i dit spil for at få den aktuelle brugers SteamID eller AccountIDsave til at gemme til og læse fra.
    • {64BitSteamID} – Brug denne variabel i Steam-stien til at indsætte brugerens 64-bit Steam-ID. Et 64-bit Steam-ID ser således ud: 76561198027391269
    • {Steam3AccountID} – Brug denne variabel i Steam-stien til at indsætte brugerens Steam 3-konto-ID. Et konto-ID ser således ud: 67125541
    Eksempel: SavesDir/{64BitSteamID}
  3. Mønster

    Filmaskemønster, der skal matches. Du kan bruge * som jokertegn. Hvis du vil have alle filer i mappen, skal du bruge *.

    Eksempel: *.sav
  4. OS

    Angiver de operativsystemer, som disse filer vil blive synkroniseret fra/til. Dette er kun nødvendigt, hvis filerne er OS-specifikke, hvilket forhåbentligt ikke er tilfældet!
  5. Rekursiv

    Medtag undermapper, når du søger efter matchende filer. Dette er nyttigt i forbindelse med undermapper med ikke-deterministiske navne såsom brugernavne eller ID'er, der ikke er fra Steam. Hvis der anvendes et Steam-ID, anbefaler vi kraftigt at bruge de særlige stiværdier i feltet "Undermappe".

Root Overrides

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

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

A Root Override consists of 5 parts.
  1. Oprindelig rod

    Dette svarer til en af de rødder, du har angivet ovenfor.
  2. OS

    Det operativsystem, som tilsidesættelsen skal gælde for.
  3. Ny rod

    Den nye placering, som den oprindelige rod er tilknyttet på det angivne OS.
  4. Tilføj/erstat sti

    Dette giver dig mulighed for at tilføje en undermappesti, som indsættes mellem den nye rod og den oprindelige undermappe.
  5. Erstat sti

    Hvis dette er slået til, erstatter stien angivet i "Tilføj/erstat sti" den oprindelige undermappe fuldstændigt.

Example: Configuring Auto-Cloud for Unity Applications

The following is an example of setting up Auto-Cloud 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/Replace Path field and Replace Path is enabled.

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

Cloud_Unity_Auto-Cloud_Example.png

Pre-release Testing

If you are adding Steam Auto-Cloud to a game which is already released and you have enabled developer-only mode during the Initial Setup then you must complete some additional steps to test the functionality.
  1. Log på Steam med en konto, som ejer en udviklerpakkelicens til den app, du vil teste.
  2. Åbn Steam-konsollen ved at navigere til steam://open/console i din browser.
  3. Indtast testappcloudpaths <AppId> i konsollen med det app-ID, som du vil teste. Eksempel: testappcloudpaths 480
  4. Indtast set_spew_level 4 4 i konsollen.
  5. Start din app fra Steam.
  6. Kontrollér, om der er aktivitet i konsollen. Hvis der i forvejen er filer i Auto-Cloud-stierne, burde du se, at de bliver uploadet. Eller gem nogle filer fra din app, og luk den for at udløse synkroniseringen.
  7. Gå til en anden PC, og gentag trinene ovenfor for at teste downloading af filerne fra Steam Auto-Cloud.
  8. Sørg for at teste det på alle understøttede operativsystemer.
  9. Indstil testcloudapppaths 0 og set_spew_level 0 0 for at afslutte testningen. Du kan genstarte Steam-klienten for at få konsolfanen væk.

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

Debugging

First, always ensure that you have published your changes on the Steam partner website and have waited up to 10 minutes or restarted your Steam client to receive the published changes.

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

See Fejlfinding i Steamworks-API'en for additional information.