Skip to content

Objectives

An Objective represents a concrete task or goal that needs to be completed as part of a quest.

Objectives are owned by Quests and managed by the Quest Manager. They can trigger and own UGameplayTasks, which are automatically cleaned up when the objective is completed or stopped.

Creating an Objective

You can create an objective by creating a new Blueprint class derived from UPulseQuestObjective.

Inside your objective Blueprint, you define what happens when the objective starts, and when it should complete.

The Lifecycle

  1. Initialization: The system calls InitObjective to determine if the objective should start based on saved data.
  2. Start: If the objective proceeds, ObjectiveStarted is called. This is where you spawn tasks, bind to events, or show UI prompts.
  3. Completion: You manually call CompleteObjective (passing either Success or Failure) when the player fulfills the goal.
  4. Cleanup: Once completed, the system fires ObjectiveCompleted and automatically destroys any active GameplayTasks associated with this objective.

Networking

Objectives can be executed differently depending on your multiplayer needs. By default, the NetMode is set to Server And Client, meaning the logic executes symmetrically on both. You can also restrict it to Server Only.

If the server completes the objective, it will automatically notify clients via an RPC, triggering ReceiveObjectiveFinished locally.

Saving & Loading

Objectives are saved along with the quest data. To utilize the save system, follow these rules:

  1. Mark the variables you want to save with the SaveGame flag.
  2. Override the GetUniqueSaveIdentifier function to return a unique ID for this objective within the quest.

When loading, the system will invoke PreLoadObjective and PostLoadObjective so you can reinitialize state based on the loaded variables.

MVVM Integration

Pulse Quest makes binding UI to Objectives incredibly simple. By assigning an ObjectiveViewModelClass (derived from UMVVMPulseObjective), you can expose the objective's state directly to Unreal's UMG MVVM system.

Network Replication

Pulse Quest supports full multiplayer synchronization out of the box. Within your custom Objective logic, both Variables and RPCs (Remote Procedure Calls) can be seamlessly replicated between the server and the clients, allowing you to easily build cooperative or competitive questing experiences.

API Reference

Below is a curated list of the most important properties and functions available on the UPulseQuestObjective class.

Important UPROPERTYs

  • bShouldBeSaved: Boolean toggle to enable/disable saving for this objective.
  • StartIfCompletedAtSave: Bitmask defining whether the objective should restart if it was previously saved in a specific state (e.g., Stopped, Failure).
  • NetMode: Determines if the objective runs on ServerAndClient or ServerOnly.
  • ObjectiveViewModelClass: The MVVM class instantiated to represent this objective in UI.
  • OnObjectiveStarted: Blueprint event broadcast when the objective starts.
  • OnObjectiveCompleted: Blueprint event broadcast when the objective finishes.

Important UFUNCTIONs

  • InitObjective(Handle, QuestTag): Evaluates if the objective should start.
  • ObjectiveStarted(): Triggered when the objective begins.
  • CompleteObjective(Mode): Call this to finish the objective (passing Success or Failure).
  • ObjectiveCompleted(): Triggered when the objective concludes.
  • GetUniqueSaveIdentifier(): Must be overridden to provide a unique save ID if bShouldBeSaved is true.
  • PreSaveToSaveGame() / PostSaveToSaveGame(): Hooks fired during the serialization process.
  • PreLoadObjective() / PostLoadObjective(): Hooks fired during the deserialization process.
  • HasAuthority(): Checks if the executing instance is running on the server.

Released under the MIT License.