How do I integrate Steam Workshop? (ISteamUGC)

0 favourites
  • 2 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • Does Construct 2 have a way to use the Steam API for the Steam workshop?

    Docs:

    Creating a Workshop Item

    1. All workshop items begin their existence with a call to SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType )

    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 CallResult handler for CreateItemResult_t

    3. When the CallResult handler is executed, read the PublishedFileId_t value and store for future updates to the workshop item (e.g. in a project file associated with the creation tool).

    4. The m_bUserNeedsToAcceptWorkshopLegalAgreement variable should also be checked and if true, the user should be redirected to accept the legal agreement. See the Workshop Legal Agreement section for more details.

    5. CreateItemResult_t.m_eResult may return any of the defined EResult's, however the following should be handled:

    k_EResultInsufficientPrivilege - The user creating the item is currently banned in the community.

    k_EResultTimeout - The operation took longer than expected, have the user retry the create process.

    k_EResultNotLoggedOn - The user is not currently logged into Steam.

    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 UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID )

    3. Using the UGCUpdateHandle_t 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.

    bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle )

    Limit the title length to 128 ASCII characters

    bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription )

    Limit the description length to 8000 ASCII characters

    bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage )

    Specify the language of the title or description that will be set in this update.

    bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData )

    Set arbitrary metadata for the item (limited to 5000 ASCII characters). This metadata can be returned from queries without having to download and install the actual item content.

    bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility )

    Valid visibility values include:

    k_ERemoteStoragePublishedFileVisibilityPublic = 0

    k_ERemoteStoragePublishedFileVisibilityFriendsOnly = 1

    k_ERemoteStoragePublishedFileVisibilityPrivate = 2

    bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags )

    Utilizes a SteamParamStringArray_t which contains a pointer to an array of char * strings and a count of the number of strings in the array.

    bool AddItemKeyValueTag( UGCUpdateHandle_t updateHandle, const char *pchKey, const char *pchValue )

    Adds a key-value tag pair to the 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.

    bool RemoveItemKeyValueTags( UGCUpdateHandle_t updateHandle, const char *pchKey )

    Remove any existing key-value tags with the specified key

    bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder )

    pszContentFolder is the absolute path to a local folder containing one or more files that represents the workshop item. For efficient upload and download, files should not be merged or compressed into single files (e.g. zip files).

    bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile )

    pszPreviewFile is the absolute path to a local preview image file for the workshop item. It must be under 1MB in size. The format should be one that both the web and the application (if necessary) can render. Suggested formats include JPG, PNG or GIF.

    4. Once the update calls have been completed, calling SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) will initiate the upload process to the Steam Workshop.

    Register a CallResult handler for SubmitItemUpdateResult_t

    When the CallResult 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 EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal )

    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 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Or would anyone be willing to make a plugin for this?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)