Skip to content

Core Concepts: Dungeon Flow Asset

What is a Dungeon Flow?

The Dungeon Flow asset is the master blueprint for your entire dungeon layout. It orchestrates the high-level structure, defining the sequence of different sections, the overall length, branching behaviour, and connections to other systems like Locks & Keys or Tile Injection.

Think of it as the top-level director telling DunGen how to assemble the dungeon using the Tile Sets and Archetypes you've defined. It uses a visual graph interface, the Flow Editor, to represent this structure.

Every DunGen generation process starts with a Dungeon Flow asset.


Creating a Dungeon Flow Asset

You create Dungeon Flow assets directly in your project:

  1. Right-click in the Project view.
  2. Navigate to Create > DunGen > Dungeon Flow.
  3. Give your new Dungeon Flow asset a descriptive name.

Inspector Settings

Selecting a Dungeon Flow asset reveals its configuration options in the Inspector:

  • Validate Dungeon: (Button) Runs a series of checks on the Dungeon Flow and its referenced assets (Tile Sets, Archetypes, Nodes) to help identify potential configuration issues that might prevent successful dungeon generation.
  • Key Manager: Assigns a Key Manager asset to enable the Lock & Key system for this dungeon flow. (See Advanced Features for details).
  • Length (Min/Max): Defines the minimum and maximum number of tiles that should make up the main path of the dungeon (from the start node to the goal node). DunGen will attempt to generate a main path within this length range.

Doorway Connection

  • Connection Chance: A percentage (0-1) determining the likelihood that two unconnected but spatially overlapping doorways will be connected by DunGen. This can create potential shortcuts or loops if set above 0.
  • Restrict to Same Section: If checked, connections created by the Connection Chance can only occur between doorways on tiles belonging to the same line segment in the Flow Editor graph. This prevents accidental shortcuts bypassing major sections defined in the flow.

Path Straightening

Global settings for defining how straight paths should be. These can be overridden on individual Archetypes and on nodes in the Flow Graph Editor.

  • Straighten Chance: A value indicating how strongly DunGen should prioritize placing the next tile directly forward, avoiding turns. Higher values result in straighter, less winding paths. A value of 0 applies no directional preference.
  • Straighten Main Path: Should the path straightening be applied to tiles on the main path?
  • Straighten Branch Paths: Should the path straightening be applied to tiles on branch paths?

Branching

  • Branch Mode: Determines how the total number of branches in the dungeon is calculated:
    • Local: The number of branches is calculated per-tile using the Branch Count settings from the owning Archetype.
    • Global: The Branch Count (Min/Max) setting defined here (directly below the Branch Mode setting) controls the total number of branches across the entire dungeon. Archetype Branch Count settings are ignored.
    • Section: Each line segment in the flow graph will have the desired number of branches specified in the Branch Count property of the segment's Archetype.
  • Branch Count (Min/Max) (Visible if Global): Defines the target minimum and maximum number of branches across the entire dungeon.
  • Branch Prune Mode: The method by which tiles at the end of a branch are removed based on the tags below.
    • Any Tags Present: Tiles at the end of a branch will be removed if any of the following tags are present. Useful for tagging tiles with a Corridor tag to avoid branches terminating in a corridor.
    • All Tags Missing: Tiles at the end of a branch will be removed if it doesn't have any of the following tags. E.g. For if you want only tiles tagged as End Cap, Shop, or Secret Room to terminate branches.
  • Branch Prune Tags: Allows you to specify Tile Tags that should cause a tile to be deleted if it appears at the very end (dead end) of a branch path. Useful for preventing inappropriate tiles (like simple corridor pieces) from being branch terminators. Tiles are removed based on the Branch Prune Mode above.
  • Special Tile Injection: Configure rules to inject specific tiles from designated Tile Sets at certain points in the dungeon layout. (See Injecting Special Tiles for details).
  • Global Props: Define the minimum and maximum number of specific Global Props that should appear across the entire dungeon. (See Advanced Features for details).
  • Tile Connection Rules: Define rules based on Tile Tags to explicitly allow or deny connections between certain types of tiles (e.g., prevent corridors from connecting only to other corridors). (See Tile Connection Rules for details).
  • Open Flow Editor: (Button) Opens the visual graph editor associated with this Dungeon Flow asset.

The Dungeon Flow asset ties all these pieces together, making it the central configuration point referenced by the Dungeon Generator component at runtime.