Quest Catalog
Table of Contents
- Overview
- The id of a quest is its tag
- Finding and loading quests
- Quests made at runtime
- Quests from a template
- Difficulty: another quest
- Daily quests with a catalog of your own
Overview
Quest managers, their clients and saves know a quest only by its tag. The quest object behind a tag comes from the definitions of PulseFoundation (page “Definitions” of the PulseFoundation docs): every quest is a definition with the id PulseQuest:<tag>.
- Quest assets need no setup: the kind
PulseQuestis registered in code for/Gameand the content of every plugin, and the default catalog of the definitions loads quest assets through the asset manager. Quests are cooked by the rule “always cook”, because quest sets hold tags, not references. - Quests made at runtime (a daily quest of a backend, a quest from a template) are registered under the same id and found before the catalog.
- A catalog of the game (Project Settings > Pulse > Foundation > Definitions, kind
PulseQuest) replaces where quests come from, e.g. a database of the studio.
A quest manager starts only quests its quest set allows; which object a tag stands for is the catalog’s business.
The id of a quest is its tag
UPulseQuest::GetPrimaryAssetId() is PulseQuest:<tag> (the tag name as the name of the id), not the asset name as for items. A quest is saved, replicated and started only by its tag, so the catalog finds it without an index, and a quest made at runtime has the same id on every machine, whatever its object is called. A quest without a tag has no id.
The asset registry keeps the id an asset had when it was saved. A quest asset saved before its tag was its id (or whose tag changed) is found by its tag only after it is saved again. Pulse Check reports these quests (“is registered as …, not as its tag”), and the setup step Quest ids saves them.
Data validation also reports two quests with the same tag: they would share one id.
Finding and loading quests
Pulse::Quest::Catalog (Quest/PulseQuestCatalog.h):
| Function | What it does |
|---|---|
QuestType | The kind PulseQuest |
MakeQuestId(Tag) / GetQuestTag(Id) | Id of a tag and back (invalid for other kinds) |
FindQuest(Context, Tag) | The quest when it is ready now (registered, or in memory); never loads |
LoadQuest(Context, Tag, Done, Timeout) | Loads it; Done gets the result and the quest, maybe at once |
LoadQuestSynchronous(Context, Tag) | Loads it at once (the game thread waits); only for code that cannot wait |
GetQuestTags(Context) | Every quest tag the catalog knows plus the registered ones, sorted |
RegisterQuest(Context, Quest) / UnregisterQuest(Context, Tag) | Quests made at runtime |
MakeQuestFromTemplate(Context, Template, Params) | A copy of a quest with another tag, registered |
ApplyStateTreeParameters(StateTree, Values) | Copies parameter values by name and type into a StateTree reference |
Blueprint (Pulse|Quest|Catalog): Get Quest Id, Find Quest, Get All Quest Tags, Register Quest, Unregister Quest, Make Quest From Template. To load a quest without a hitch use Load Pulse Definition of PulseFoundation with the class Pulse Quest.
A quest manager resolves quests itself: see pending starts and clients.
Quests made at runtime
Make an object of the Pulse Quest class (Construct Object in Blueprint, NewObject in C++), give it a tag, texts and a StateTree, and register it:
UPulseQuest* quest = NewObject<UPulseQuest>(GetTransientPackage());
quest->Tag = DailyTag;
quest->StateTree = Template->StateTree;
Pulse::Quest::Catalog::RegisterQuest(this, quest);
- Register it on every machine that needs it: the server starts it, clients show it (their quest manager resolves the replicated tag through the catalog). The definitions keep it alive until it is unregistered or the game instance ends.
- A registered quest hides an asset with the same tag.
- A quest set must allow the tag: list it in
Quests, or put it below one of the set’sQuestGroups(for exampleQuest.Dailyfor every daily quest). - Saving keeps only the tag and the state. Register the quest again before a load, then the quest manager restarts it.
Quests from a template
A daily quest is usually “template + number + text”. MakeQuestFromTemplate copies a quest and changes what FPulseQuestTemplateParams names:
| Member | Effect |
|---|---|
Tag | The tag (and id) of the new quest; required, not the tag of the template |
DisplayName, Description | Replace the texts; empty keeps those of the template |
StateTreeParameters | Values for StateTree parameters with the same name and type (for example Count = 20); other parameters keep their value. C++ only: property bags are no Blueprint type |
bReplaceRewards, Rewards | Replace the rewards, or keep those of the template |
The copy is named after its id (PulseQuest_Quest_Daily_Wood) and registered. Make it on every machine with the same params. The cheat PulseQuestMakeQuest <template tag> <new tag> does it on the machine that runs it and on the server (see Console).
Difficulty: another quest
A difficulty (Pulse Difficulty or any tuning source of PulseFoundation) can use another quest for a tag: a Swap Asset adjustment (FPulseAdjustment_Swap) with the quest asset as Original and a variant as Replacement, for example a harder hunt with more enemies or a timer. Make the replacement a copy (or a child data asset) of the original with the same tag.
- Where it happens: a quest manager asks the tuning when it keeps a quest the catalog gave it (
UPulseQuestRuntime::KeepQuest): on a start (ResolveQuest, ready or loaded at once), when an asynchronous load answers (HandleQuestLoaded), on preloads, on clients that resolve the replicated tag, and in the check pass of a load (the quest data class). The quest of the catalog stays kept; the variant is whatFindQuestand new starts use. - Context: the player of the quest manager (when it has exactly one; a shared host with several players asks only the shared sources), the quest as source and the quest tag in the tags.
- Same tag only: saves, conditions, the history and quest sets know a quest by its tag, so a replacement with another tag (or none) is ignored with a warning and the original is used. The rule is
Pulse::Quest::ChooseQuestVariant(Original, Replacement)(pure, specPulseQuest.Swap);Pulse::Quest::ResolveQuestVariant(Context, Quest, Player)resolves it in a world. - Loading: the catalog loads the original asynchronously as before. A replacement that is not in memory is loaded at once (the game thread waits, as with
Pulse::Adjustments::ResolveObject): keep replacements referenced, for example by the difficulty or preset that swaps them, or preload them. - Changes: when the tuning changes (a new difficulty) or the quest definitions change, the variants of the kept quests are resolved again. New starts use the new variant; running quests keep the quest they started with, also after a save and load restarts them with the variant that is current then.
- Multiplayer: server and clients resolve with their own tuning (a client has the shared sources and those of its players), so put swaps for everyone into shared sources.
Daily quests with a catalog of your own
When quests come from a backend, a catalog of the kind PulseQuest gives every machine the same quests without calls of its own on each of them:
- Derive a catalog from
UPulseDefinitionCatalog(C++ or Blueprint). InLoad Definition, ask the backend for the quest of the id (Pulse::Quest::Catalog::GetQuestTaggives the tag), make it from a template (MakeQuestFromTemplate, or a copy kept in the catalog) and answer with Finish Load Definition. Keep the quests in a property of the catalog.Get Definition Idslists today’s quests (quest boards, cheats). - Name the class for the kind
PulseQuestin Project Settings > Pulse > Foundation > Definitions. - Put the parent tag of the daily quests into
QuestGroupsof the quest set.
The server starts a daily quest as soon as the catalog answered (a pending start); a client resolves the replicated tag through the same catalog and shows the quest when it arrived. When the backend publishes new quests, call Notify Changed on the catalog.