Flow Graph Documentation

repository·5.x·Indexed 23 days ago

https://github.com/mothcocoon/flowgraph

An open-source, design-agnostic event node editor for Unreal Engine used to script game flow and narrative events. Unlike function-based Blueprints, Flow Graph utilizes stateful UObject nodes that react to asynchronous events. Key features include Gameplay Tag-based communication via Flow Components, integration with Unreal SaveGame and Sequencer, debug tools like Force Pin Activation, and Signal Modes for safe graph updates during game patches.

Tokens
5.6K
Snippets
4
Records
34
Agent score
83%

What's inside Flow Graph

  1. What is Flow Graph?

    5.x
    Flow Graph is a design-agnostic event node editor for Unreal Engine, specifically tailored for scripting the flow of events in virtual worlds. Unlike Unreal Engine Blueprints, which are function-based, Flow Graph is built around the concept of nodes as UObject instances. This allows a single node to encapsulate an entire gameplay element, including both its logic and its data, enabling the creation of repeatable "event scripts."
  2. Understand Signal Modes for safe graph updates

    5.x

    Signal Modes allow designers to modify Flow Graph logic in game patches without breaking existing SaveGames. Because Flow Graphs serialize the state of active nodes to a SaveGame, removing a node post-launch can cause issues with legacy saves. Instead of removing nodes, you can change their Signal Mode to alter their behavior while maintaining graph compatibility.

    There are three primary Signal Modes:

    • Enabled: The default state. The node executes its logic normally.
    • Disabled: The node's logic is not executed, and any Input Pin activation is ignored. The node immediately enters a deactivated state.
    • PassThrough: The node's internal logic is skipped, but all connected output pins are triggered, allowing the execution flow to continue through the node.

    Since pin connections are not serialized to SaveGames, you can safely change connections on nodes set to PassThrough to reroute logic during patches.

  3. Core concepts of Flow Graph nodes

    5.x

    To use Flow Graph effectively, understand these fundamental architectural differences from standard Blueprints:

    • Nodes as UObjects: Each node is a UObject, not a function. This means a node can hold its own state and data, acting as a self-contained gameplay feature.
    • Async/Latent by Design: Flow Nodes are inherently asynchronous. Instead of executing a linear block of code, active nodes typically subscribe to delegates and react to events by triggering output pins.
    • Customizable Pins: Every node defines its own set of input and output pins to facilitate game flow design.
    • Debug Visibility: The editor supports displaying debug information directly on nodes and wires during gameplay. Developers can specify what kind of messages are displayed over active nodes to monitor real-time execution.
    • Extensibility: Flow Graph is a base system. You extend it by writing your own custom nodes and editor customizations tailored to your specific game requirements.
  4. How to separate logic between multiple graphs

    5.x
    To manage complex logic and prevent a single graph from becoming unmanageable, use the Sub Graph node. This allows you to nest graphs, such as starting a specific graph for a quest or event from a parent graph. This modular approach is the recommended way to structure large-scale logic.
  5. How to reference actors in Flow Graph

    5.x

    Flow Graph nodes can communicate with world actors without requiring direct hard references, which improves flexibility and compatibility with World Partition. There are three primary ways to obtain actor references:

    1. Gameplay Tags (Recommended):

      • Add a Flow Component to an actor (the "event actor").
      • Assign Gameplay Tags to that component to identify the actor.
      • The Flow Component registers itself with the Flow Subsystem upon appearing in the world.
      • Nodes can then query the Flow Subsystem for actors registered with a specific tag. This is ideal for runtime-spawned actors like NPCs.
    2. Soft Object References: Useful for referencing specific, unique objects like triggers or spawn points without hard-loading them immediately.

    3. Guids: Used for identifying specific instances of actors.

  6. Understand when to use Flow vs. Gameplay Ability System (GAS)

    5.x

    Flow and GAS are designed for different layers of gameplay and different user personas. Choosing between them depends on whether you are scripting systemic mechanics or directed narrative events.

    Use Gameplay Ability System (GAS) for:

    • Second-to-second gameplay: Implementing core loops like skills, attacks, spells, buffs, and debuffs.
    • Systemic mechanics: Managing complex interactions between player/AI actions (e.g., spell X interrupting attack Z).
    • Gameplay Designers: Developers scripting mechanics in Blueprints or C++ that require efficient network replication.
    • Player/AI-driven actions: Abilities tied to Pawns and Controllers where the execution depends on real-time player decisions.

    Use Flow for:

    • Minute-to-minute gameplay: Scripting pre-designed, event-heavy sequences and storylines.
    • Directed events: Creating predictable cause-effect chains (e.g., a quest sequence or a scripted mission).
    • Content Designers: Non-technical designers (writers, level designers) who need to translate story documents into a visual graph.
    • Event-driven logic: Triggering actions based on specific world events (e.g., entering a trigger volume, depleting a resource, or completing an objective).
  7. Core Concepts of Flow Graph

    5.x

    Flow Graph is a design-agnostic event node editor for Unreal Engine designed to script the flow of events in virtual worlds. Unlike Blueprints, it follows these core principles:

    • Nodes as UObjects: A single node is a UObject rather than a function. This allows a node to encapsulate both logic and data, making it a reusable "event script."
    • Async/Latent by Design: Nodes are inherently asynchronous. They typically subscribe to delegates and react to events by triggering output pins.
    • Decoupled Systems: Flow Graph acts as a bridge between gameplay programmers (who write the system code) and content designers (who connect the nodes). Systems do not need to know about each other; they are combined by connecting nodes in the graph.
    • Debug Visibility: The editor supports displaying debug information directly on nodes and wires during gameplay. Developers can provide custom messages to be displayed over active Flow Nodes.
    • World Agnostic: Flow Graph assets are not part of the world. They can exist independently of specific levels or sublevels, making them compatible with UE5's World Partition.
  8. Limiting Asset Search by asset type

    5.x

    You can exclude specific asset types from the Asset Search indexing process to improve performance or focus your search. This can be configured at two levels:

    • Project Level: Via Project Settings.
    • User Level: Via Editor Preferences.

    This functionality requires merging specific engine modifications (such as the Search Roles addition).

  9. How to run a Flow Graph independent from the world

    5.x
    You can run global graphs (e.g., for meta-quests or achievement tracking) that are not tied to a specific world instance. To do this, create a Flow Asset instance from anywhere in the game by calling the UFlowSubsystem::StartRootFlow method.
    UFlowSubsystem::StartRootFlow
  10. Integrate Flow Graph with Unreal SaveGame system

    5.x

    Flow Graph integrates with Unreal Engine's USaveGame system via the UFlowSaveGame object. To include Flow Graph data in your save files, you must ensure your properties are marked with the SaveGame specifier in C++ or by checking the SaveGame checkbox in the Blueprint editor.

    To complete the integration, you must call the following methods on the UFlowSubsystem (accessible from Blueprints) during your save/load lifecycle:

    • OnGameSaved: Call this when you are performing a save operation.
    • OnGameLoaded: Call this when you have finished deserializing your save data.

    Active graphs are serialized into the UFlowSaveGame object, which is managed by the UFlowSubsystem registry.