User content
Module PulseOnlineStorage lists, subscribes, downloads and uploads items of user made content (mods, maps, skins) through IPulseOnlineUserContentService: the Steam Workshop, mod.io or a service of the game, and folders on the disk in the Mock backend. Mounting the installed files (a pak, a folder of data the game reads) is up to the game; Pulse Online tells it where they are.
Items
FPulseOnlineContentItem: ItemId, Title, Description, AuthorId, Tags, SizeBytes, UpdatedAt, PreviewUrl and what this machine knows of it:
| State | Meaning |
|---|---|
None | Not subscribed, not installed. |
Subscribed | Subscribed, not downloaded yet. |
Downloading | Progress in [0, 1]. |
Installed | The files are in InstalledFolder. |
NeedsUpdate | Installed, but the service has a newer version. |
The subsystem
UPulseOnlineUserContentSubsystem (game instance, exists with the storage module: Enable Storage):
| Function | Request | What it does |
|---|---|---|
QueryContent(Query) | UPulseOnlineQueryContentRequest | Lists items: Kind All (public, filtered by Tags and SearchText), ItemIds, Subscribed, Published (of the user); Page, PageSize. Result: Items, Total. |
SubscribeContent(ItemId, bSubscribe) | UPulseOnlineSubscribeContentRequest | Subscribes, or ends the subscription (the service may remove the files). |
DownloadContent(ItemId, bHighPriority) | UPulseOnlineDownloadContentRequest | Installs or updates an item. Result: Item with InstalledFolder. No timeout. |
UploadContent(Upload) | UPulseOnlineUploadContentRequest | Uploads a new item (empty ItemId) or an update: Title, Description, Tags, ContentFolder, PreviewFile, Visibility, ChangeNote. Result: ItemId; Progress and OnProgress while it runs. No timeout. |
Get Content State (GetContentState) | – | What this machine knows of an item. |
Get Installed Content (GetInstalledContent) | – | The installed items of the first local user. |
On Content Changed (OnContentChanged, OnContentChangedNative) | – | An item changed here: subscribed, download progress, installed, removed. |
Every request runs in the queue UserContent of the subsystem and has UserId (empty: the first local user, who must be logged in online). Blueprints run them with Execute Online Request or the subsystem functions above.
UPulseOnlineUserContentSubsystem* Content = UPulseOnlineUserContentSubsystem::Get(this);
Content->OnContentChangedNative.AddUObject(this, &UMyModsMenu::HandleContentChanged);
FPulseOnlineContentQuery Query;
Query.Tags = { TEXT("Map") };
Content->QueryContent(Query);
// Later, for the item the player picked
Content->SubscribeContent(ItemId);
Content->DownloadContent(ItemId);
// At start: mount what is installed
for (const FPulseOnlineContentItem& Item : Content->GetInstalledContent())
{
MountModFolder(Item.InstalledFolder);
}
Blueprint: Subscribe to an item and download it
Get Game Instance Subsystem(Pulse Online User Content Subsystem) → bindOn Content Changed(Item): showProgresswhileStateisDownloading.Subscribe Content(Item Id) →Execute Online Request.- Success →
Download Content(Item Id) →Execute Online Request. - Success →
Cast To Pulse Online Download Content Request(Execute Online Requestreturns the base class; the request fromDownload Contentitself is already typed) →Item→Installed Folder: mount or read the files of the game.
Mock backend
The Mock backend keeps items as folders under Saved/PulseOnline/MockContent (MockContentFolder of the backend):
Items/<Id>/item.jsondescribes an item (title, description, author, tags, version, visibility),Items/<Id>/Contentholds its files,Items/<Id>/preview.<ext>the preview picture.- An upload copies the content folder into
Items/<Id>/Content; a new item gets the idmock-item-<n>. Only the author updates an item; every update raises its version. - A download copies the files to
Installed/<Id>in two steps of the latency of the backend (progress 0, 0.5, then installed); an installed item whose version is older than the item isNeedsUpdate. - Subscriptions are kept per game instance; ending one removes the installed copy.
FailNextOperationfailsContentQuery,ContentSubscribe,ContentDownloadandContentUpload.
Items made by hand work too: a folder with an item.json and a Content folder.
Own services
A Blueprint or C++ class of Online User Content Provider serves the items from a service of the game (Service Providers); it reports download progress and installed items with Notify Item Changed and upload progress with Report Upload Progress. A Steam Workshop service comes with PulseOnlineSteam in a later version.
Testing
- Spec
PulseOnline.Storage.UserContent(upload, lists, tags, subscribe, download with progress, installed folder, update, unknown items). - Cheat
PulseOnlineContent [List|Subscribe <Id>|Unsubscribe <Id>|Download <Id>|Installed|Upload <Folder>](a relative folder is read from the project folder).