TSteamUGC
Steam UGC API
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.
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. By using the OnItemInstalled callback within your game, you can then call 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.
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:
- Navigate to the Steam Cloud Settings page in the App Admin panel.
- Set the Byte quota per user and Number of files allowed per user to appropriate values for preview image storage
- Click Save Cloud Changes
- From the Publish tab, click Prepare for Publishing
- Click Publish to Steam and complete the process to publish the change.
Enabling the ISteamUGC API can be accomplished with the following steps:
- Navigate to the Steam Workshop Configuration page in the App Admin panel.
- Find the Additional Configuration Options section
- Check on Use ISteamUGC for file transfer
- Click Save Additional Configuration Options
- From the Publish tab, click Prepare for Publishing
- 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.
Creating a Workshop Item
- All workshop items begin their existence with a call to CreateItem
- The consumerAppId 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.
- Register a call result handler for OnCreateItem.
- First check the result to ensure that the item was created successfully.
- When the call result handler is executed, read the publishedFileId value and store for future updates to the workshop item (e.g. in a project file associated with the creation tool).
- The userNeedsToAcceptWorkshopLegalAgreement 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
- Once a workshop item has been created and a published file id value has been returned, the content of the workshop item can be populated and uploaded to the Steam Workshop.
- An item update begins with a call to StartItemUpdate
- Using the update handle that is returned from StartItemUpdate, calls can be made to update the Title, Description, Visibility, Tags, Item Content and Item Preview Image through the various
SetItem[...]
methods.
- SetItemTitle - Sets a new title for an item.
- SetItemDescription - Sets a new description for an item.
- SetItemUpdateLanguage - Sets the language of the title and description that will be set in this item update.
- SetItemMetadata - Sets arbitrary metadata for an item. This metadata can be returned from queries without having to download and install the actual content.
- SetItemVisibility - Sets the visibility of an item.
- SetItemTags - Sets arbitrary developer specified tags on an item.
- AddItemKeyValueTag - Adds a key-value tag pair to an item. Keys can map to multiple different values (1-to-many relationship).
- RemoveItemKeyValueTags - Removes an existing key value tag from an item.
- SetItemContent - Sets the folder that will be stored as the content for an item.
- SetItemPreview -Sets the primary preview image for the item.
- Once the update calls have been completed, calling SubmitItemUpdate will initiate the upload process to the Steam Workshop.
- Register a call result handler for OnSubmitItemUpdate
- When the call result handler is executed, check the result to confirm the upload completed successfully.
- Note: There is no method to cancel the item update and upload once it's been called.
- If desired, the progress of the upload can be tracked using GetItemUpdateProgress
- EItemUpdateStatus defines the upload and update progress.
- bytesProcessed and bytesTotal can be used to provide input for a user interface control such as a progress bar to indicate progress of the upload.
- bytesTotal may update during the upload process based upon the stage of the item update.
- 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 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.
- SubscribeItem - Subscribe to a workshop item. It will be downloaded and installed as soon as possible.
- UnsubscribeItem - Unsubscribe from a workshop item. This will result in the item being removed after the game quits.
Two additional methods exist for enumerating through a user's subscribed items.
- GetNumSubscribedItems - Gets the total number of items the current user is subscribed to for the game or application.
- GetSubscribedItems - Gets a list of all of the items the current user is subscribed to for the current game.
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):
- Register a callback handler for OnRemoteStoragePublishedFileSubscribed and OnRemoteStoragePublishedFileUnsubscribed
- The publishedFileId will be returned which can then be used to access the information about the workshop item.
- The application ID (@appID) associated with the workshop item will also be returned. It should be compared against the running application ID as the handler will be called for all item subscriptions regardless of the running application.
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:
- When the Steam Client indicates a game or application is to launch, all app depots that have been updated will be downloaded and installed.
- Any existing installed workshop items are updated if needed
- Game or application then launches
- 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
- GetItemState - Gets the current state of a workshop item on this client.
Download Progress of a Workshop Item
- GetItemDownloadInfo - Get info about a pending download of a workshop item that has k_EItemStateNeedsUpdate set.
Initiate or Increase the Priority of Downloading a Workshop Item
- Set highPriority 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 OnDownloadItem before calling 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 EItemState of k_EItemStateNeedsUpdate, 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 OnDownloadItem 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
- GetItemInstallInfo - Gets info about currently installed content on the disc for workshop items that have k_EItemStateInstalled set.
Notification when a Workshop Item is Installed or Updated
- Register a callback handler for OnItemInstalled.
Querying Content
The TSteamUGC interface provides a flexible way to enumerate the various kinds of UGC in Steam (e.g. Workshop items, screenshots, videos, etc.).
- Register a call result handler for OnSteamUGCQueryCompleted.
- 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.
- CreateQueryUserUGCRequest - Query UGC associated with a user. You can use this to list the UGC the user is subscribed to amongst other things.
- CreateQueryAllUGCRequest - Query for all matching UGC. You can use this to list all of the available UGC for your app.
- CreateQueryUGCDetailsRequest - Query for the details of specific workshop items.
- Customize the query as appropriate by calling the option setting methods:
When querying for User UGC
- SetCloudFileNameFilter - Sets to only return items that have a specific filename on a pending UGC Query.
When querying for All UGC
- SetMatchAnyTag - Sets whether workshop items will be returned if they have one or more matching tag, or if all tags need to match on a pending UGC Query.
- SetSearchText - Sets a string to that items need to match in either the title or the description on a pending UGC Query.
- SetRankedByTrendDays - Sets whether the order of the results will be updated based on the rank of items over a number of days on a pending UGC Query.
When querying for either type of UGC
- AddRequiredTag - Adds a required tag to a pending UGC Query. This will only return UGC with the specified tag.
- AddExcludedTag - Adds a excluded tag to a pending UGC Query. This will only return UGC without the specified tag.
- AddRequiredKeyValueTag - Adds a required key-value tag to a pending UGC Query. This will only return workshop items that have a key =
key
and a value =value
. - SetReturnOnlyIDs - Sets whether to only return IDs instead of all the details on a pending UGC Query. This is useful for when you don't need all the information (e.g. you just want to get the IDs of the items a user has in their favorites list.)
- SetReturnKeyValueTags - Sets whether to return any key-value tags for the items on a pending UGC Query.
- SetReturnLongDescription - Sets whether to return the full description for the items on a pending UGC Query.
- SetReturnMetadata - Sets whether to return the developer specified metadata for the items on a pending UGC Query.
- SetReturnChildren - Sets whether to return the IDs of the child items of the items on a pending UGC Query.
- SetReturnAdditionalPreviews - Sets whether to return any additional images/videos attached to the items on a pending UGC Query.
- SetReturnTotalOnly - Sets whether to only return the total number of matching items on a pending UGC Query. -- The actual items will not be returned when ISteamUGC::SteamUGCQueryCompleted_t is called.
- SetLanguage - Sets the language to return the title and description in for the items on a pending UGC Query.
- SetAllowCachedResponse - Sets whether results to be will be returned from the cache for the specific period of time on a pending UGC Query.
- Send the query to Steam using SendQueryUGCRequest which will invoke the OnSteamUGCQueryCompleted call result handler registered in step 1.
- In the call result handler for OnSteamUGCQueryCompleted, call GetQueryUGCResult to retrieve the details for each item returned.
- 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):
- GetQueryUGCPreviewURL - Retrieve the URL to the preview image of an individual workshop item after receiving a querying UGC call result.
- GetQueryUGCMetadata - Retrieve the developer set metadata of an individual workshop item after receiving a querying UGC call result.
- GetQueryUGCChildren - Retrieve the ids of any child items of an individual workshop item after receiving a querying UGC call result.
- GetQueryUGCStatistic - Retrieve various statistics of an individual workshop item after receiving a querying UGC call result.
- GetQueryUGCNumAdditionalPreviews and GetQueryUGCAdditionalPreview - Retrieve the details of an additional preview associated with an individual workshop item after receiving a querying UGC call result.
- GetQueryUGCNumKeyValueTags and GetQueryUGCKeyValueTag - Retrieve the details of a key-value tag associated with an individual workshop item after receiving a querying UGC call result.
- Call 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 StartPlaytimeTracking with the ids of the items you want to track. Then when the items are removed from play call StopPlaytimeTracking with the ids you want to stop tracking or call 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 CreateQueryAllUGCRequest queries. Here are the playtime based query types you can use:
- k_EUGCQuery_RankedByPlaytimeTrend - Sort by total playtime in the "trend" period descending (set with SetRankedByTrendDays)
- k_EUGCQuery_RankedByTotalPlaytime - Sort by total lifetime playtime descending.
- k_EUGCQuery_RankedByAveragePlaytimeTrend - Sort by average playtime in the "trend" period descending (set with SetRankedByTrendDays)
- k_EUGCQuery_RankedByLifetimeAveragePlaytime - Soft by lifetime average playtime descending
- k_EUGCQuery_RankedByPlaytimeSessionsTrend - Sort by number of play sessions in the "trend" period descending (set in SetRankedByTrendDays)
- k_EUGCQuery_RankedByLifetimePlaytimeSessions - Sort by number of lifetime play sessions descending
Deleting Workshop Item Content
To delete a Workshop item, you can call DeleteItem. Please note that this does not prompt the user and cannot be undone.
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.
- 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)
- 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/<PublishedFileId_t> replacing <PublishedFileId_t> with the workshop item id.
This has the benefit of directing the author to the workshop page so that they can see the item and configure it further if necessary and will make it easy for the user to read and accept the Steam Workshop Legal Agreement.
Errors and Logging
The majority of TSteamUGC methods return boolean values. For additional information on specific errors, there are a number of places to review:
Steam\logs\Workshop_log.txt
is a log for all transfers that occur during workshop item downloading and installation.Steam\workshopbuilds\depot_build_<appid>.log
is a log for all actions during the upload and update of a workshop item.- OnSteamUGCQueryCompleted, OnCreateItem and OnSubmitItemUpdate contain EResult variables that can be checked.
Methods
Method AddAppDependency(publishedFileID:ULong, appID:UInt)
Adds a dependency between the given item and the appid.
This list of dependencies can be retrieved by calling GetAppDependencies. This is a soft-dependency that is displayed on the web. It is up to the application to determine whether the item can actually be used or not.
See Also: RemoveAppDependency
Method AddDependency(publishedFileId:ULong, childPublishedFileId:ULong)
Adds a workshop item as a dependency to the specified item.
If the parentPublishedFileID item is of type k_EWorkshopFileTypeCollection, then the childPublishedFileID is simply added to that collection. Otherwise, the dependency is a soft one that is displayed on the web and can be retrieved via the TSteamUGC API using a combination of the numChildren member variable of the SteamUGCDetails_t struct and GetQueryUGCChildren.
See Also: RemoveDependency
Method AddExcludedTag:Int(queryHandle:ULong, tagName:String)
Adds a excluded tag to a pending UGC Query.
This will only return UGC without the specified tag.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: AddRequiredTag, SetMatchAnyTag, SetItemTags
Returns
True upon success or False if the UGC query handle is invalid, if the UGC query handle is from CreateQueryUGCDetailsRequest, or tagName was Null.
Method AddItemKeyValueTag:Int(queryHandle:ULong, key:String, value:String)
Adds a key-value tag pair to an item.
Keys can map to multiple different values (1-to-many relationship).
Key names are restricted to alpha-numeric characters and the '_' character. Both keys and values cannot exceed 255 characters in length. Key-value tags are searchable by exact match only.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: RemoveItemKeyValueTags, SetReturnKeyValueTags, GetQueryUGCNumKeyValueTags, GetQueryUGCKeyValueTag
Method AddItemPreviewFile:Int(queryHandle:ULong, previewFile:String, previewType:EItemPreviewType)
Adds an additional preview file for the item.
Then the format of the image should be one that both the web and the application (if necessary) can render, and must be under 1MB. Suggested formats include JPG, PNG and GIF.
NOTE: Using k_EItemPreviewType_YouTubeVideo or k_EItemPreviewType_Sketchfab are not currently supported with this API. For YouTube videos you should use AddItemPreviewVideo.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: GetQueryUGCNumAdditionalPreviews, GetQueryUGCAdditionalPreview, SetReturnAdditionalPreviews, UpdateItemPreviewFile, AddItemPreviewVideo, RemoveItemPreview
Method AddItemPreviewVideo:Int(queryHandle:ULong, videoID:String)
Adds an additional video preview from YouTube for the item.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: GetQueryUGCNumAdditionalPreviews, GetQueryUGCAdditionalPreview, SetReturnAdditionalPreviews, UpdateItemPreviewVideo, AddItemPreviewFile, RemoveItemPreview
Method AddItemToFavorites(appId:UInt, publishedFileID:ULong)
Adds a workshop item to the users favorites list.
See Also: RemoveItemFromFavorites
Method AddRequiredKeyValueTag:Int(queryHandle:ULong, key:String, value:String)
Adds a required key-value tag to a pending UGC Query.
This will only return workshop items that have a key = pKey and a value = pValue.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: AddExcludedTag, SetMatchAnyTag, SetItemTags
Method AddRequiredTag:Int(queryHandle:ULong, tagName:String)
Adds a required tag to a pending UGC Query.
This will only return UGC with the specified tag.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: AddExcludedTag, SetMatchAnyTag, SetItemTags
Method InitWorkshopForGameServer:Int(workshopDepotID:ULong, folder:String)
Lets game servers set a specific workshop folder before issuing any UGC commands.
This is helpful if you want to support multiple game servers running out of the same install folder.
Returns
True upon success, otherwise, False if the calling user is not a game server or if the workshop is currently updating it's content.
Method CreateItem(consumerAppId:UInt, FileType:EWorkshopFileType)
Creates a new workshop item with no content attached yet.
Method CreateQueryAllUGCRequest:ULong(queryType:EUGCQuery, matchingeMatchingUGCTypeFileType:EUGCMatchingUGCType, creatorAppID:UInt, consumerAppID:UInt, page:UInt)
Query for all matching UGC.
You can use this to list all of the available UGC for your app.
This will return up to 50 results per page. You can make subsequent calls to this method, increasing page each time to get the next set of results.
NOTE: Either consumerAppID or creatorAppID must have a valid AppID!
NOTE: You must release the handle returned by this function by calling ReleaseQueryUGCRequest when you are done with it!
To query for the UGC associated with a single user you can use CreateQueryUserUGCRequest instead.
Method CreateQueryUGCDetailsRequest:ULong(publishedFileIDs:ULong[])
Query for the details of specific workshop items.
This will return up to 50 results per page.
NOTE: Either consumerAppID or creatorAppID must have a valid AppID!
NOTE: You must release the handle returned by this function by calling ReleaseQueryUGCRequest when you are done with it!
To query all the UGC for your app you can use CreateQueryAllUGCRequest instead.
Method CreateQueryUGCDetailsRequest:ULong(publishedFileIDs:ULong Ptr, numPublishedFileIDs:Int)
Query for the details of specific workshop items.
This will return up to 50 results per page.
NOTE: Either consumerAppID or creatorAppID must have a valid AppID!
NOTE: You must release the handle returned by this function by calling ReleaseQueryUGCRequest when you are done with it!
To query all the UGC for your app you can use CreateQueryAllUGCRequest instead.
Method CreateQueryUserUGCRequest:ULong(accountID:UInt, listType:EUserUGCList, matchingUGCType:EUGCMatchingUGCType, sortOrder:EUserUGCListSortOrder, creatorAppID:UInt, consumerAppID:UInt, page:UInt)
Query UGC associated with a user.
You can use this to list the UGC the user is subscribed to amongst other things. This will return up to 50 results per page. You can make subsequent calls to this method, increasing page each time to get the next set of results.
NOTE: Either consumerAppID or creatorAppID must have a valid AppID!
NOTE: You must release the handle returned by this function by calling ReleaseQueryUGCRequest when you are done with it!
To query all the UGC for your app you can use CreateQueryAllUGCRequest instead.
Method DeleteItem(publishedFileID:ULong)
Deletes the item without prompting the user.
Results in a cal to OnDeleteItem.
Method DownloadItem:Int(publishedFileID:ULong, highPriority:Int)
Downloads or updates a workshop item.
If the return value is True then wait for the callback to OnDownloadItem before calling 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 item state of k_EItemStateNeedsUpdate, then this method can be called to initiate the update. Do not access the workshop item on disk until the callback OnDownloadItem is called.
The OnDownloadItem callback contains the app ID associated with the workshop item. It should be compared against the running app ID as the handler will be called for all item downloads regardless of the running application.
Returns
True if the download was successfully started, otherwise, False if publishedFileID is invalid or the user is not logged on.
Method GetAppDependencies(publishedFileID:ULong)
Gets the app dependencies associated with the given publishedFileID.
These are "soft" dependencies that are shown on the web. It is up to the application to determine whether an item can be used or not.
Results in a call to OnGetAppDependencies.
See Also: AddAppDependency, RemoveAppDependency
Method GetItemDownloadInfo:Int(publishedFileID:ULong, bytesDownloaded:ULong Var, bytesTotal:ULong Var)
Gets info about a pending download of a workshop item that has k_EItemStateNeedsUpdate set.
Returns
True if the download information was available, otherwise, False.
Method GetItemInstallInfo:Int(publishedFileID:ULong, sizeOnDisk:ULong Var, folder:String Var, timestamp:UInt Var)
Gets info about currently installed content on the disc for workshop items that have k_EItemStateInstalled set.
Calling this sets the "used" flag on the workshop item for the current player and adds it to their k_EUserUGCList_UsedOrPlayed list.
If k_EItemStateLegacyItem is set then folder contains the path to the legacy file itself, not a folder.
Method GetItemState:EItemState(publishedFileID:ULong)
Gets the current state of a workshop item on this client.
Method GetItemUpdateProgress:EItemUpdateStatus(queryHandle:ULong, bytesProcessed:ULong Var, bytesTotal:ULong Var)
Gets the progress of an item update.
See Also: SubmitItemUpdate
Returns
The current status.
Method GetNumSubscribedItems:UInt()
Gets the total number of items the current user is subscribed to for the game or application.
Returns
0 if called from a game server.
Method GetQueryUGCAdditionalPreview:Int(queryHandle:ULong, index:UInt, previewIndex:UInt, URLOrVideoID:String Var, originalFileName:String Var, previewType:EItemPreviewType Var)
Retrieves the details of an additional preview associated with an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
Before calling this you should call GetQueryUGCNumAdditionalPreviews to get number of additional previews.
Returns
True upon success, indicates that URLOrVideoID and previewType have been filled out. Otherwise, False if the UGC query handle is invalid, the index is out of bounds, or previewIndex is out of bounds.
Method GetQueryUGCChildren:Int(queryHandle:ULong, index:UInt, publishedFileIDs:ULong Ptr, maxEntries:UInt)
Retrieves the ids of any child items of an individual workshop item after receiving a querying UGC call result.
These items can either be a part of a collection or some other dependency (see AddDependency).
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
You should create publishedFileIDs with numChildren provided in OnSteamUGCDetails after getting the UGC details with GetQueryUGCResult.
Returns
True upon success, indicates that publishedFileIDs has been filled out. Otherwise, False if the UGC query handle is invalid or the index is out of bounds.
Method GetQueryUGCKeyValueTag:Int(queryHandle:ULong, index:UInt, keyValueTagIndex:UInt, key:String Var, value:String Var)
Retrieves the details of a key-value tag associated with an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
Before calling this you should call GetQueryUGCNumKeyValueTags to get number of tags.
Returns
True upon success, indicates that key and value have been filled out. Otherwise, False if the UGC query handle is invalid, the index is out of bounds, or keyValueTagIndex is out of bounds.
Method GetQueryUGCMetadata:Int(queryHandle:ULong, index:UInt, metadata:String Var)
Retrieves the developer set metadata of an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
See Also: SetItemMetadata
Returns
True upon success, indicates that metadata has been filled out. Otherwise, false if the UGC query handle is invalid or the index is out of bounds.
Method GetQueryUGCNumAdditionalPreviews:UInt(queryHandle:ULong, index:UInt)
Retrieve the number of additional previews of an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
You can then call GetQueryUGCAdditionalPreview to get the details of each additional preview.
Returns
The number of additional previews associated with the specified workshop item. Returns 0 if the UGC query handle is invalid or the index is out of bounds.
Method GetQueryUGCNumKeyValueTags:UInt(queryHandle:ULong, index:UInt)
Retrieves the number of key-value tags of an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
You can then call GetQueryUGCKeyValueTag to get the details of each tag.
Returns
The number of key-value tags associated with the specified workshop item. Returns 0 if the UGC query handle is invalid or the index is out of bounds.
Method GetQueryUGCPreviewURL:Int(queryHandle:ULong, index:UInt, URL:String Var)
Retrieves the URL to the preview image of an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
You can use this URL to download and display the preview image instead of having to download it using the previewFile from the SteamUGCDetails.
Returns
True upon success, indicates that pchURL has been filled out. Otherwise, false if the UGC query handle is invalid or the index is out of bounds.
Method GetQueryUGCStatistic:Int(queryHandle:ULong, index:UInt, statType:EItemStatistic, statValue:ULong Var)
Retrieves various statistics of an individual workshop item after receiving a querying UGC call result.
You should call this in a loop to get the details of all the workshop items returned.
NOTE: This must only be called with the handle obtained from a successful OnSteamUGCQueryCompleted call result.
Returns
True upon success, indicates that pStatValue has been filled out. Otherwise, False if the UGC query handle is invalid, the index is out of bounds, or statType was invalid.
Method GetSubscribedItems:UInt(publishedFileIDs:ULong Ptr, maxEntries:UInt)
Gets a list of all of the items the current user is subscribed to for the current game.
You create an array with the size provided by GetNumSubscribedItems before calling this.
Returns
The number of subscribed workshop items that were populated into publishedFileIDs. Returns 0 if called from a game server.
Method GetUserItemVote(publishedFileID:ULong)
Gets the users vote status on a workshop item.
Results in a call to OnGetUserItemVote.
See Also: SetUserItemVote
Method ReleaseQueryUGCRequest:Int(queryHandle:ULong)
Releases a UGC query handle when you are done with it to free up memory.
Returns
Always returns True.
Method RemoveAppDependency(publishedFileID:ULong, appID:UInt)
Removes the dependency between the given item and the appid.
This list of dependencies can be retrieved by calling GetAppDependencies.
Results in a call to OnRemoveAppDependency.
See Also: AddAppDependency
Method RemoveDependency(parentPublishedFileID:ULong, childPublishedFileID:ULong)
Removes a workshop item as a dependency from the specified item.
Results in a call to OnRemoveUGCDependency.
See Also: AddDependency
Method RemoveItemFromFavorites(appId:UInt, publishedFileID:ULong)
Removes a workshop item from the users favorites list.
Results in a call to OnUserFavoriteItemsListChanged.
See Also: AddItemToFavorites
Method RemoveItemKeyValueTags:Int(queryHandle:ULong, key:String)
Removes an existing key value tag from an item.
You can only call this up to 100 times per item update. If you need remove more tags than that you'll need to make subsequent item updates.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: AddItemKeyValueTag
Returns
True upon success, otherwise False if the UGC update handle is invalid or if you are trying to remove more than 100 key-value tags in a single update.
Method RemoveItemPreview:Int(queryHandle:ULong, index:UInt)
Removes an item preview.
Method SendQueryUGCRequest(queryHandle:ULong)
Sends a UGC query to Steam.
This must be called with a handle obtained from CreateQueryUserUGCRequest, CreateQueryAllUGCRequest, or CreateQueryUGCDetailsRequest to actually send the request to Steam. Before calling this you should use one or more of the following APIs to customize your query: AddRequiredTag, AddExcludedTag, SetReturnOnlyIDs, SetReturnKeyValueTags, SetReturnLongDescription, SetReturnMetadata, SetReturnChildren, SetReturnAdditionalPreviews, SetReturnTotalOnly, SetLanguage, SetAllowCachedResponse, SetCloudFileNameFilter, SetMatchAnyTag, SetSearchText, SetRankedByTrendDays, AddRequiredKeyValueTag
Results in a call to OnSteamUGCQueryCompleted.
Method SetAllowCachedResponse:Int(queryHandle:ULong, maxAgeSeconds:UInt)
Sets whether results will be returned from the cache for the specific period of time on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, False if the UGC query handle is invalid.
Method SetCloudFileNameFilter:Int(queryHandle:ULong, matchCloudFileName:String)
Sets to only return items that have a specific filename on a pending UGC Query.
NOTE: This can only be used with CreateQueryUserUGCRequest!
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid, if the UGC query handle is not from CreateQueryUserUGCRequest or if matchCloudFileName is not set.
Method SetItemContent:Int(updateHandle:ULong, contentFolder:String)
Sets the folder that will be stored as the content for an item.
For efficient upload and download, files should not be merged or compressed into single files (e.g. zip files).
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
Returns
True upon success, False if the UGC update handle is invalid.
Method SetItemDescription:Int(updateHandle:ULong, description:String)
Sets a new description for an item.
The description must be limited to the length defined by k_cchPublishedDocumentDescriptionMax.
You can set what language this is for by using SetItemUpdateLanguage, if no language is set then "english" is assumed.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: SetReturnLongDescription
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method SetItemMetadata:Int(updateHandle:ULong, metaData:String)
Sets arbitrary metadata for an item.
This metadata can be returned from queries without having to download and install the actual content.
The metadata must be limited to the size defined by k_cchDeveloperMetadataMax.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: SetReturnMetadata
Returns
True upon success, otherwise False if the UGC update handle is invalid, or if metadata is longer than k_cchDeveloperMetadataMax.
Method SetItemPreview:Int(updateHandle:ULong, previewFile:String)
Sets the primary preview image for the item.
The format should be one that both the web and the application (if necessary) can render. Suggested formats include JPG, PNG and GIF.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method SetItemTags:Int(updateHandle:ULong, tags:String[])
Sets arbitrary developer specified tags on an item.
Each tag must be limited to 255 characters. Tag names can only include printable characters, excluding ','. For reference on what characters are allowed, refer to http://en.cppreference.com/w/c/string/byte/isprint
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
Returns
True upon success, otherwise False if the UGC update handle is invalid, or if one of the tags is invalid either due to exceeding the maximum length or because it is empty.
Method SetItemTitle:Int(updateHandle:ULong, title:String)
Sets a new title for an item.
The title must be limited to the size defined by k_cchPublishedDocumentTitleMax.
You can set what language this is for by using SetItemUpdateLanguage, if no language is set then "english" is assumed.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method SetItemUpdateLanguage:Int(updateHandle:ULong, language:String)
Sets the language of the title and description that will be set in this item update.
This must be in the format of the API language code.
If this is not set then "english" is assumed.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: SetItemTitle, SetItemDescription, SetLanguage
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method SetItemVisibility:Int(updateHandle:ULong, visibility:ERemoteStoragePublishedFileVisibility)
Sets the visibility of an item.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method SetLanguage:Int(queryHandle:ULong, language:String)
Sets the language to return the title and description in for the items on a pending UGC Query.
This must be in the format of the API Language code.
If this is not set then "english" is assumed.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: SetItemUpdateLanguage
Returns
True upon success, otherwise False if the UGC query handle is invalid.
Method SetMatchAnyTag:Int(queryHandle:ULong, matchAnyTag:Int)
Sets whether workshop items will be returned if they have one or more matching tag, or if all tags need to match on a pending UGC Query.
NOTE: This can only be used with CreateQueryAllUGCRequest!
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: AddRequiredTag, AddExcludedTag, SetItemTags
Returns
True upon success, otherwise False if the UGC query handle is invalid or if the UGC query handle is not from CreateQueryAllUGCRequest.
Method SetRankedByTrendDays:Int(queryHandle:ULong, days:UInt)
Sets whether the order of the results will be updated based on the rank of items over a number of days on a pending UGC Query.
NOTE: This can only be used with CreateQueryAllUGCRequest!
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid, if the UGC query handle is not from CreateQueryAllUGCRequest or if the EUGCQuery of the query is not one of k_PublishedFileQueryType_RankedByTrend, k_PublishedFileQueryType_RankedByPlaytimeTrend, k_PublishedFileQueryType_RankedByAveragePlaytimeTrend, k_PublishedFileQueryType_RankedByVotesUp, or k_PublishedFileQueryType_RankedByPlaytimeSessionsTrend.
Method SetReturnAdditionalPreviews:Int(queryHandle:ULong, returnAdditionalPreviews:Int)
Sets whether to return any additional images/videos attached to the items on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid.
Method SetReturnChildren:Int(queryHandle:ULong, returnChildren:Int)
Sets whether to return the IDs of the child items of the items on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid.
Method SetReturnKeyValueTags:Int(queryHandle:ULong, returnKeyValueTags:Int)
Sets whether to return any key-value tags for the items on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, False if the UGC query handle is invalid.
Method SetReturnLongDescription:Int(queryHandle:ULong, returnLongDescription:Int)
Sets whether to return the full description for the items on a pending UGC Query.
If you don't set this then you only receive the summary which is the description truncated at 255 bytes.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: SetItemDescription
Returns
True upon success, otherwise False if the UGC query handle is invalid.
Method SetReturnMetadata:Int(queryHandle:ULong, returnMetadata:Int)
Sets whether to return the developer specified metadata for the items on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
See Also: SetItemMetadata
Returns
True upon success, False if the UGC query handle is invalid.
Method SetReturnOnlyIDs:Int(queryHandle:ULong, returnOnlyIDs:Int)
Sets whether to only return IDs instead of all the details on a pending UGC Query.
This is useful for when you don't need all the information (e.g. you just want to get the IDs of the items a user has in their favorites list.)
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid or if the UGC query handle is from CreateQueryUGCDetailsRequest.
Method SetReturnPlaytimeStats:Int(queryHandle:ULong, days:UInt)
Sets whether to return the the playtime stats on a pending UGC Query.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, otherwise False if the UGC query handle is invalid.
Method SetReturnTotalOnly:Int(queryHandle:ULong, returnTotalOnly:Int)
Sets whether to only return the the total number of matching items on a pending UGC Query.
The actual items will not be returned when OnSteamUGCQueryCompleted is called.
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, False if the UGC query handle is invalid or if the UGC query handle is from CreateQueryUGCDetailsRequest.
Method SetSearchText:Int(queryHandle:ULong, searchText:String)
Sets a string to that items need to match in either the title or the description on a pending UGC Query.
NOTE: This can only be used with CreateQueryAllUGCRequest!
NOTE: This must be set before you send a UGC Query handle using SendQueryUGCRequest.
Returns
True upon success, False if the UGC query handle is invalid, if the UGC query handle is not from CreateQueryAllUGCRequest or if searchText is empty.
Method SetUserItemVote(publishedFileID:ULong, voteUp:Int)
Allows the user to rate a workshop item up or down.
Results in a call to OnSetUserItemVote.
See Also: GetUserItemVote
Method StartItemUpdate:ULong(consumerAppId:UInt, publishedFileID:ULong)
Starts the item update process.
This gets you a handle that you can use to modify the item before finally sending off the update to the server with SubmitItemUpdate.
See Also: Uploading a Workshop Item, SetItemTitle, SetItemDescription, SetItemUpdateLanguage, SetItemMetadata, SetItemVisibility, SetItemTags, SetItemContent, SetItemPreview, RemoveItemKeyValueTags, AddItemKeyValueTag, AddItemPreviewFile, AddItemPreviewVideo, UpdateItemPreviewFile, UpdateItemPreviewVideo, RemoveItemPreview
Returns
A handle that you can use with future calls to modify the item before finally sending the update.
Method StartPlaytimeTracking(publishedFileIDs:ULong Ptr, numPublishedFileIDs:UInt)
Starts tracking playtime on a set of workshop items.
When your app shuts down, playtime tracking will automatically stop.
Results in a call to OnStartPlaytimeTracking
See Also: StopPlaytimeTracking, StopPlaytimeTrackingForAllItems
Method StopPlaytimeTracking(publishedFileIDs:ULong Ptr, numPublishedFileIDs:UInt)
Stops tracking playtime on a set of workshop items.
When your app shuts down, playtime tracking will automatically stop.
Results in a call to OnStopPlaytimeTracking
Method StopPlaytimeTrackingForAllItems()
Stops tracking playtime of all workshop items.
When your app shuts down, playtime tracking will automatically stop.
Results in a call to OnStopPlaytimeTracking
Method SubmitItemUpdate(updateHandle:ULong, changeNote:String)
Uploads the changes made to an item to the Steam Workshop.
You can track the progress of an item update with GetItemUpdateProgress.
Results in a call to OnSubmitItemUpdate
Method SubscribeItem(publishedFileID:ULong)
Subscribe to a workshop item. It will be downloaded and installed as soon as possible.
Results in a call to OnRemoteStorageSubscribePublishedFile
See Also: SubscribeItem
Method SuspendDownloads(suspend:Int)
Suspends and resumes all workshop downloads.
If you call this with suspend set to True then downloads will be suspended until you resume them by setting suspend to False or when the game ends.
Method UnsubscribeItem(publishedFileID:ULong)
Unsubscribes from a workshop item.
This will result in the item being removed after the game quits.
Results in a call to OnRemoteStorageUnsubscribePublishedFile
See Also: UnsubscribeItem
Method UpdateItemPreviewFile:Int(updateHandle:ULong, index:UInt, previewFile:String)
Updates an existing additional preview file for the item.
If the preview type is an image then the format should be one that both the web and the application (if necessary) can render, and must be under 1MB. Suggested formats include JPG, PNG and GIF.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: AddItemPreviewFile
Returns
True upon success, otherwise False if the UGC update handle is invalid.
Method UpdateItemPreviewVideo:Int(updateHandle:ULong, index:UInt, videoID:String)
Updates an additional video preview from YouTube for the item.
NOTE: This must be set before you submit the UGC update handle using SubmitItemUpdate.
See Also: AddItemPreviewVideo
Returns
True upon success, otherwise False if the UGC update handle is invalid.