Unaffiliated

Home Documentation & Help
Steamworks Documentation
Steam Workshop Implementation Guide

Introduction

Steam Workshop is a system of back-end storage and front-end web pages that make it easy to store, organize, sort, rate, and download content for your game or application.

This page contains technical details on implementing Steam Workshop with your title. For information and definitions of the various types of Workshop integration you can utilize and how to make the best out of the tools provided by Steam please see the Steam Workshop Overview before getting started integrating the steam workshop with your game.

In a typical set-up, customers of your game would use tools provided by you with purchase of your game to create modifications or entirely new content. Those customers would then submit that content through a form built into your tool to the Steam Workshop. Other customers would then be able to browse, sort, rate, and subscribe to items they wish to add to their game by going to the Steam Workshop in the Steam Community. Those items would then download through Steam. If you've registered for the ISteamUGC::ItemInstalled_t callback within your game, you can then call ISteamUGC::GetItemInstallInfo to get the installed location and read the data directly from that folder. That new content would then be recognized by the game in whatever capacity makes sense for your game and the content created.

Steam Workshop Types, Monetization, & Best Practices

For more information and definitions of the various types of Workshop integration you can utilize and how to make the best out of the tools provided by Steam, please see the Steam Workshop documentation.

Managing Steam Workshop Visibility

The Steam Workshop is the website hosted through Steam that enumerates shared content and allows users to vote and comment on the content visible through the community. By default, applications are not enabled to be publicly visible in the Workshop. This prevents content not intended to be shared through the Steam Workshop portal from being visible unless the workshop is set to public.
Set the visibility state of the workshop through the following steps:
  1. Browse to the application landing page on the Steamworks website
  2. Click Edit Steamworks Settings
  3. From the Workshop Tab, select General
  4. On the right-hand side of the page, find the Visibility State section.
  5. Use the radio buttons to select the desired level of visibility which can include Developers Only, Developers & Testers, Customers & Developers and Everyone.
  6. From the Publish tab, click Prepare for Publishing
  7. Click Publish to Steam and complete the process to publish the change.
Note: To change the visibility state to Everyone, the Workshop checklist must be complete which includes branding, title, description and at least one item of content publicly visible.

Tech Overview

The process to share and consume User Generated Content is by using the ISteamUGC API which can be found in the Steamworks SDK. The methods exposed provide a way to share workshop item content which can then be discovered through the Steam Workshop or an in-app experience.

The Workshop API must be accessed through the pointer that is returned from SteamUGC().

For example:
SteamAPICall_t hSteamAPICall = SteamUGC()->CreateItem( SteamUtils()->GetAppID(), k_EWorkshopFileTypeMicrotransaction );

Enabling ISteamUGC for a Game or Application

Before workshop items can be uploaded to the Steamworks backend there are two configuration settings that must be made, Configuring Steam Cloud Quotas and Enabling the ISteamUGC API.

The Steam Cloud feature is used to store the preview images associated to workshop items. The Steam Cloud Quota can be configured with the following steps:
  1. Navigate to the Steam Cloud Settings page in the App Admin panel.
  2. Set the Byte quota per user and Number of files allowed per user to appropriate values for preview image storage
  3. Click Save Cloud Changes
  4. From the Publish tab, click Prepare for Publishing
  5. Click Publish to Steam and complete the process to publish the change.

Enabling the ISteamUGC API can be accomplished with the following steps:
  1. Navigate to the Steam Workshop Configuration page in the App Admin panel.
  2. Find the Additional Configuration Options section
  3. Check on Use ISteamUGC for file transfer
  4. Click Save Additional Configuration Options
  5. From the Publish tab, click Prepare for Publishing
  6. Click Publish to Steam and complete the process to publish the change.
Once these settings are in place workshop content can be uploaded via the API.

Creating and Uploading Content

The process of creating and uploading workshop content is a simple and repeatable process as shown in the flow chart below.

ISteamUGCFlow-CreateUpload-Web2.png

Creating a Workshop Item

  1. All workshop items begin their existence with a call to ISteamUGC::CreateItem
    • The nConsumerAppId variable should contain the App ID for the game or application. Do not pass the App ID of the workshop item creation tool if that is a separate App ID.
    • EWorkshopFileType is an enumeration type that defines how the shared file will be shared with the community. The valid values are:
      • k_EWorkshopFileTypeCommunity - This file type is used to describe files that will be uploaded by users and made available to download by anyone in the community. Common usage of this would be to share user created mods.
      • k_EWorkshopFileTypeMicrotransaction - This file type is used to describe files that are uploaded by users, but intended only for the game to consider adding as official content. These files will not be downloaded by users through the Workshop, but will be viewable by the community to rate.
        This is the implementation that Team Fortress 2 uses.
  2. Register a call result handler for CreateItemResult_t
  3. First check the m_eResult to ensure that the item was created successfully.
  4. When the call result handler is executed, read the m_nPublishedFileId value and store for future updates to the workshop item (e.g. in a project file associated with the creation tool).
  5. The m_bUserNeedsToAcceptWorkshopLegalAgreement variable should also be checked and if it's true, the user should be redirected to accept the legal agreement. See the Workshop Legal Agreement section for more details.

Uploading a Workshop Item

  1. Once a workshop item has been created and a PublishedFileId_t value has been returned, the content of the workshop item can be populated and uploaded to the Steam Workshop.
  2. An item update begins with a call to ISteamUGC::StartItemUpdate
  3. Using the UGCUpdateHandle_t that is returned from ISteamUGC::StartItemUpdate, calls can be made to update the Title, Description, Visibility, Tags, Item Content and Item Preview Image through the various ISteamUGC::SetItem[...] methods.
  4. Once the update calls have been completed, calling ISteamUGC::SubmitItemUpdate will initiate the upload process to the Steam Workshop.
    • Register a call result handler for SubmitItemUpdateResult_t
    • When the call result handler is executed, check the m_eResult to confirm the upload completed successfully.
    • Note: There is no method to cancel the item update and upload once it's been called.
  5. If desired, the progress of the upload can be tracked using ISteamUGC::GetItemUpdateProgress
    • EItemUpdateStatus defines the upload and update progress.
    • punBytesProcessed and punBytesTotal can be used to provide input for a user interface control such as a progress bar to indicate progress of the upload.
    • punBytesTotal may update during the upload process based upon the stage of the item update.
  6. In the same way as Creating a Workshop Item, confirm the user has accepted the legal agreement. This is necessary in case where the user didn't initially create the item but is editing an existing item.

Additional Notes

  • Workshop items were previously designated as single files. With ISteamUGC, a workshop item is a representation of a folder of files.
  • If a workshop item requires additional metadata for use by the consuming application, you can attach metadata to your item using the ISteamUGC::SetItemMetadata call. This metadata can be returned in queries without having to download and install the item content.
    Previously we suggested that you save this metadata to a file inside the workshop item folder, which of course you can still do.

Consuming Content

Consuming workshop content falls into two categories, Item Subscription and Item Installation.

Item Subscription

The majority of subscriptions to a workshop item will happen through the Steam Workshop portal. It is a known location, common to all games and applications, and as such, users are likely to find and subscribe to items regularly on the workshop site.

However, ISteamUGC provides two methods for programmatically subscribing and unsubscribing to workshop items to support in-game item subscription management.

Two additional methods exist for enumerating through a user's subscribed items.

Receiving Notifications for External Subscription Actions

In-game notifications can be received when a user has subscribed or unsubscribed from a file through any mechanism (e.g. ISteamUGC, Steam Workshop Website):

Item Installation

Once Item Subscription information is known, the remaining consumption methods can be utilized. These methods provide information back to the game about the state of the item download and installation. Workshop item downloads are executed via the Steam Client and happen automatically, based on the following rules:
  1. When the Steam Client indicates a game or application is to launch, all app depots that have been updated will be downloaded and installed.
  2. Any existing installed workshop items are updated if needed
  3. Game or application then launches
  4. Newly subscribed workshop items that are not downloaded will then download and be installed in the background.
    • Subscribed files will be downloaded to the client in the order they were subscribed in.
    • The Steam download page will show workshop item downloads with a specific banner to indicate a workshop item download is occurring.
Note: Using the "Verify Integrity of Game Files" feature in the Steam Client will also cause workshop items to be downloaded.

As the game will start before newly subscribed content is downloaded and installed, the remaining consumption methods exist to aid in monitoring and managing the install progress. They can also be used when items are subscribed in-game to provide status of installation in real time.

Status of a Workshop Item

Download Progress of a Workshop Item

Initiate or Increase the Priority of Downloading a Workshop Item

  • ISteamUGC::DownloadItem
    • Set bHighPriority to true to pause any existing in-progress downloads and immediately begin downloading this workshop item.
    • If the return value is true then register and wait for the callback ISteamUGC::DownloadItemResult_t before calling ISteamUGC::GetItemInstallInfo or accessing the workshop item on disk.
    • If the user is not subscribed to the item (e.g. a Game Server using anonymous login), the workshop item will be downloaded and cached temporarily.
    • If the workshop item has an ISteamUGC::EItemState of k_EItemStateNeedsUpdate, ISteamUGC::DownloadItem can be called to initiate the update. Do not access the workshop item on disk until the callback ISteamUGC::DownloadItemResult_t is called.
    • This method only works with ISteamUGC created workshop items. It will not work with legacy ISteamRemoteStorage workshop items.
    • The ISteamUGC::DownloadItemResult_t callback struct contains the application ID (m_unAppID) associated with the workshop item. It should be compared against the running application ID as the handler will be called for all item downloads regardless of the running application.

Retrieving information about the local copy of the Workshop Item

Notification when a Workshop Item is Installed or Updated

Querying Content

The ISteamUGC interface provides a flexible way to enumerate the various kinds of UGC in Steam (e.g. Workshop items, screenshots, videos, etc.).

ISteamUGCFlows-QueryingContent-web2.png

  1. Register a call result handler for SteamUGCQueryCompleted_t.
  2. There are a few methods available for creating the query depending upon the required scenario, Querying by Content Associated to a User or Querying All Content or getting the details of content you have ids for.
  3. Customize the query as appropriate by calling the option setting methods:
  4. Send the query to Steam using ISteamUGC::SendQueryUGCRequest which will invoke the ISteamUGC::SteamUGCQueryCompleted_t call result handler registered in step 1.
  5. In the call result handler for ISteamUGC::SteamUGCQueryCompleted_t, call ISteamUGC::GetQueryUGCResult to retrieve the details for each item returned.

  6. You can also call these functions to retrieve additional information for each item (some of this data is not returned by default, so you need to configure your query appropriately):
  7. Call ISteamUGC::ReleaseQueryUGCRequest to free up any memory allocated while querying or retrieving the results.

Paging Results

Up to 50 results will be returned from each query. Paging through more results can be achieved by creating a query that increments the unPage parameter (which should start at 1).

Playtime Tracking

To track the playtime of Workshop items simply call ISteamUGC::StartPlaytimeTracking with the ids of the items you want to track. Then when the items are removed from play call ISteamUGC::StopPlaytimeTracking with the ids you want to stop tracking or call ISteamUGC::StopPlaytimeTrackingForAllItems to stop tracking playtime for all items at once.
When your app shuts down, playtime tracking will automatically stop.

You will also be able to sort items by various playtime metrics in ISteamUGC::CreateQueryAllUGCRequest queries. Here are the playtime based query types you can use:

Deleting Workshop Item Content

At this time there is no method to permanently delete a published workshop item from the API. Instead, call ISteamUGC::SetItemVisibility with k_ERemoteStoragePublishedFileVisibilityPrivate to hide the item from public or friends.

Steamworks Example – SpaceWar Integration

The Steamworks API Example Application (SpaceWar) that comes with the Steamworks SDK demonstrates a subset of the ISteamUGC API.
  • CSpaceWarClient::LoadWorkshopItem demonstrates checking if a workshop item is downloaded and installed on disk as well as requesting information about a workshop item by ISteamRemoteStorage::PublishedFileId_t
  • CSpaceWarClient::LoadWorkshopItems demonstrates retrieving the list of subscribed workshop items for the current user for the SpaceWar application
  • CSpaceWarClient::OnWorkshopItemInstalled demonstrates a callback handler for ISteamUGC::ItemInstalled_t

Workshop Legal Agreement

Workshop items will be hidden by default until the contributor agrees to the Steam Workshop Legal Agreement. In order to make it easy for the contributor to make the item publicly visible, please do the following.
  1. Include text next to the button that submits an item to the workshop, something to the effect of: "By submitting this item, you agree to the workshop terms of service" (including the link)
  2. After a user submits an item, open a browser window to the Steam Workshop page for that item by calling ISteamFriends::ActivateGameOverlayToWebPage with pchURL set to steam://url/CommunityFilePage/