Skip to content

Shared Quests

A Shared Quest Manager handles quests for a group of players simultaneously, perfect for cooperative multiplayer games (e.g., party-based RPGs or co-op shooters).

Instead of attaching a UPulseQuestManager component to individual players, you use an actor called APulseSharedQuestHost. This actor acts as the central authority for the shared session.

Setting Up a Shared Host

  1. Create a Blueprint derived from APulseSharedQuestHost.
  2. Place this actor in your level, or spawn it dynamically on the Server when a party is formed.
  3. Because it replicates ActiveQuests and ActiveObjectives globally to all associated players, ensure it is set to replicate.

Managing Players

The Shared Quest Host maintains a list of participating players. Only the server can modify this list.

When a player joins a party, you register them with the Host.

text
[Server Authority]
MySharedQuestHost -> AddPlayer(PlayerController)

When they leave the party, you remove them:

text
[Server Authority]
MySharedQuestHost -> RemovePlayer(PlayerController)

Players added to the host will automatically receive replicated quest states and UI updates as if they had a personal quest manager.

API Reference

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

Important UPROPERTYs

  • ManagerParams: Configuration structure for the shared manager.
  • QuestStarted: Event broadcast when a shared quest begins.
  • QuestStopped: Event broadcast when a shared quest concludes.
  • ObjectiveStarted: Event broadcast when a shared objective begins.
  • ObjectiveStopped: Event broadcast when a shared objective concludes.

Important UFUNCTIONs

  • AddPlayer(TScriptInterface<IPulseSharedQuestPlayerInterface> NewPlayer): Adds a player to the shared session (Server Only).
  • RemovePlayer(TScriptInterface<IPulseSharedQuestPlayerInterface> PlayerToRemove): Removes a player from the shared session (Server Only).
  • HasPlayerState(const APlayerState* PlayerState): Checks if a specific player state is part of the session.
  • GetAllPlayerStates(TArray<APlayerState*>& OutPlayers): Retrieves all player states currently tracked by the host.
  • GetSharedQuestManagerData(): Returns the UPulseSharedQuestManagerData object holding persistent data.

Released under the MIT License.