Quest Director
Table of Contents
Overview
The Quest Director is an optional, server-only object that manages the narrative layer of quests — deciding when to start or stop quests, scripting cutscene-like sequences, and handling global storyline state.
When a Director is configured, it takes full responsibility for starting quests on load (bypassing the default “restart all saved quests” behavior).
UPulseQuestDirector
Configuration
Set ManagerParams.QuestDirectorClass on the UPulseQuestManager or APulseSharedQuestHost to a subclass of UPulseQuestDirector.
Lifecycle
| Event | When |
|---|---|
Init(Manager) | Immediately after the Quest Manager initializes |
Start() | Called by the manager; State moves from Idle → Running |
Stop() | Called on manager reset or explicit stop |
Tick(DeltaTime) | Each tick while State == Running |
OnSaveGame(SaveData) | Manager is saving; Director writes its data |
OnLoadGame(SaveData) | Manager loaded; Director reads its data and starts quests |
Director state (EPulseQuestDirectorState)
| Value | Meaning |
|---|---|
Idle | Not yet started |
Running | Actively driving quest flow |
Stopped | Stopped, will not tick |
Blueprint API
GetQuestManager() → TScriptInterface<IPulseQuestManagerInterface>
GetQuestManagerData() → UPulseQuestManagerData*
GetState() → EPulseQuestDirectorState
IsRunning() → bool
StartQuest(Tag, OutReason) → bool
StopQuest(Tag, Result) → bool
K2_OnInit() – override: initialization
K2_OnStart() – override: begin directing
K2_OnStop() – override: cleanup
K2_OnSaveGame(SaveData) – override: write director save data
K2_OnLoadGame(SaveData) – override: read director save data + start quests
Save data key
The director stores its serialized bytes in the save game under:
Pulse.Quest.Save.Director (FGameplayTag constant)
UPulseQuestStateTreeDirector
A specialized Director subclass that runs a StateTree asset (UPulseQuestDirectorStateTreeSchema). This is the recommended approach for complex non-linear storylines.
Configuration
- Create a
UStateTreeasset compiled withUPulseQuestDirectorStateTreeSchema. - Set
StateTreeproperty on yourUPulseQuestStateTreeDirectorsubclass (or directly on the default object in the Blueprint).
Schema context objects
| Name | Type |
|---|---|
QuestManager | Implements IPulseQuestManagerInterface |
QuestManagerData | UPulseQuestManagerData |
QuestDirector | UPulseQuestDirector |
StateTree lifecycle
Start()callsFStateTreeInstanceData::Initand starts StateTree execution.Tick()callsFStateTree::Tick.Stop()callsFStateTree::Stop.- Transitions in the StateTree can start/stop quests using the Director-variant tasks (same task library, Director context).
Load Behavior
When no Director is configured:
- All quests saved with
FPulseQuestSaveRecordare automatically restarted if their flags allow it (i.e.,PQF_NoStartOnLoadis not set).
When a Director is present:
- The automatic restart behavior is suppressed.
- The Director’s
K2_OnLoadGame/OnLoadGameis called with the deserialized save data. - The Director is responsible for starting quests in the correct narrative order.
// Example: C++ Director restoring state
void UMyDirector::OnLoadGame(const FPulseQuestSaveGameView& SaveData)
{
Super::OnLoadGame(SaveData);
// Check which quests were saved and re-sequence
for (const FPulseQuestSaveRecord& Record : SaveData.QuestRecords)
{
if (Record.bIsActive)
{
FGameplayTagContainer Reason;
StartQuest(Record.QuestTag, Reason);
}
}
}