Dialogue Sequencer

Full API reference for the DialogueSequencerComponent and DialogueUIBridgeComponent — runtime dialogue graph traversal, node processing, and UI routing.

The Dialogue Sequencer is the runtime engine that executes dialogue sequences node-by-node. It receives a DialogueSequence from the Dialogue Manager, traverses the node graph, evaluates conditions, fires effects and performances, and routes text and selection events to the UI layer through the DialogueUIBridgeComponent.

The two components on this page work together:

ComponentRole
DialogueSequencerComponentTraverses the node graph. Processes each DialogueNodeData in order, manages runtime tokens, and signals sequence completion.
DialogueUIBridgeComponentDecouples the sequencer from presentation. Routes dialogue text and selection events to whichever DialogueUIComponent or DialogueUISelectionComponent is currently registered.

For usage guides and setup examples, see The Basics: GS_Cinematics.

 

Contents


DialogueSequencerComponent

The sequencer is the core playback controller. When a sequence starts, the sequencer reads the startNodeId, resolves the first node, and begins processing. Each node type has its own processing logic:

  • TextNodeData – Sends text, speaker, and portrait data to the UI bridge for display.
  • SelectionNodeData – Sends options to the UI bridge. Waits for a player selection before continuing.
  • RandomNodeData – Picks a random outgoing connection (pure random or weighted) and continues.
  • EffectsNodeData – Executes all attached DialogueEffect instances, then continues.
  • PerformanceNodeData – Starts a DialoguePerformance. Waits for the performance to signal completion before continuing.

At each node, outgoing connections are evaluated. Conditions on connections are tested in priority order; the first connection whose conditions all pass is followed. When no outgoing connections remain, the sequence ends.


Request Bus: DialogueSequencerRequestBus

Singleton bus – Single address, single handler.

MethodParametersReturnsDescription
StartDialogueBySequenceconst DialogueSequence& sequencevoidBegins playback of the given sequence from its startNodeId.
OnPerformanceCompletevoidCalled by a running DialoguePerformance when it finishes. The sequencer advances to the next node.

Notification Bus: DialogueSequencerNotificationBus

Multiple handler bus – any number of components can subscribe.

EventParametersDescription
OnDialogueTextBeginconst DialogueTextPayload& payloadFired when the sequencer begins processing a text node. Contains speaker name, text, portrait, and display settings.
OnDialogueSequenceCompleteFired when the sequencer reaches the end of a sequence (no further outgoing connections).

Runtime Token Management

The sequencer maintains a set of runtime tokens that track state within a single sequence execution. Tokens are used internally to prevent infinite loops, track visited nodes, and manage branching state. They are cleared when a sequence completes or is interrupted.


DialogueUIBridgeComponent

The UI Bridge sits between the sequencer and the presentation layer. It holds a reference to the currently registered DialogueUIComponent and DialogueUISelectionComponent. When the sequencer needs to display text or a selection menu, it calls the bridge, which forwards the request to the active UI. This allows you to swap between screen-space, world-space, or custom UI implementations at runtime without changing the sequencer or the dialogue data.


Request Bus: DialogueUIBridgeRequestBus

Singleton bus.

MethodParametersReturnsDescription
RunDialogueconst DialogueTextPayload& payloadvoidForwards a dialogue text event to the registered DialogueUIComponent.
RunSelectionconst DialogueSelectionPayload& payloadvoidForwards a selection event to the registered DialogueUISelectionComponent.
RegisterDialogueUIAZ::EntityId uiEntityvoidRegisters the entity whose DialogueUIComponent and/or DialogueUISelectionComponent will receive events.
CloseDialoguevoidTells the registered UI to close and clean up.

Notification Bus: DialogueUIBridgeNotificationBus

Multiple handler bus.

EventParametersDescription
OnDialogueCompleteFired when the registered UI finishes displaying a dialogue line (after typewriter completes or the player advances). The sequencer listens for this to advance to the next node.
OnSelectionCompleteint selectedIndexFired when the player selects an option. The sequencer uses the index to follow the corresponding connection.

Execution Flow

A typical dialogue playback follows this path:

  1. StartDialogueManagerRequestBus::StartDialogueSequenceByName("MySequence") looks up the sequence in the active database and calls DialogueSequencerRequestBus::StartDialogueBySequence(sequence).
  2. Node Processing – The sequencer reads the start node and begins processing. For each node:
    • Text – The sequencer calls DialogueUIBridgeRequestBus::RunDialogue(payload). The bridge forwards to the registered UI. The UI displays text (via TypewriterComponent), then fires OnDialogueComplete. The sequencer advances.
    • Selection – The sequencer calls DialogueUIBridgeRequestBus::RunSelection(payload). The bridge forwards to the selection UI. The player picks an option, the UI fires OnSelectionComplete(index). The sequencer follows the indexed connection.
    • Effects – The sequencer executes each DialogueEffect on the node, then advances immediately.
    • Performance – The sequencer starts the DialoguePerformance. When the performance calls OnPerformanceComplete, the sequencer advances.
    • Random – The sequencer picks a connection and advances immediately.
  3. End – When no outgoing connections remain, the sequencer fires OnDialogueSequenceComplete and calls DialogueUIBridgeRequestBus::CloseDialogue().

C++ Usage

Starting a Sequence

#include <GS_Cinematics/GS_CinematicsBus.h>

// Start by name through the Dialogue Manager
GS_Cinematics::DialogueManagerRequestBus::Broadcast(
    &GS_Cinematics::DialogueManagerRequestBus::Events::StartDialogueSequenceByName,
    AZStd::string("PerryConfrontation")
);

Listening for Sequence Completion

#include <GS_Cinematics/GS_CinematicsBus.h>

class MyListener
    : public AZ::Component
    , protected GS_Cinematics::DialogueSequencerNotificationBus::Handler
{
protected:
    void Activate() override
    {
        GS_Cinematics::DialogueSequencerNotificationBus::Handler::BusConnect();
    }

    void Deactivate() override
    {
        GS_Cinematics::DialogueSequencerNotificationBus::Handler::BusDisconnect();
    }

    void OnDialogueSequenceComplete() override
    {
        // Sequence finished — resume gameplay, unlock camera, etc.
    }
};

See Also

For conceptual overviews and usage guides:

For component references:

For related resources:


Get GS_Cinematics

GS_Cinematics — Explore this gem on the product page and add it to your project.