Skip to main content

Tutorial 3: Combining World and Dungeon

In this advanced tutorial, we will use the Dungeon Generator node to "inject" a structured dungeon into a procedurally generated world.

The Goal

We want a large organic world (like a forest or cave) that contains several structured dungeons (like ancient ruins) tucked away inside it.


Step 1: Set Up the Base World

Start with a graph similar to the one created in Tutorial 1.

  1. Open your CaveGraph.

Step 2: Pick Dungeon Locations

We need to decide where the dungeons should go.

  1. Add a Poisson Disc Sampler node.
  2. Adjust the Minimum Distance so you don't have too many dungeons too close together.
  3. This node will output a Point List.

Dungeon Location


Step 3: Add the Dungeon Generator Node

  1. Add a Dungeon Generator node.
  2. Connect the Poisson Disc Sampler's Points output to the Dungeon Generator's Points input.
  3. In the node inspector:
    • Assign your SimpleDungeonFlow (from Tutorial 2).
    • Tweak the generation parameters to your liking.

Dungeon Generator


Step 4: Final Output

Now we merge the dungeon's footprint and prefabs into the final world output.

  1. Merge Logical IDs:
    • Add a Logical ID Overlay node.
    • Connect your world's Logical ID channel from Bool Mask to Logical ID node to the Base port.
    • Connect the Reserved Mask from the Dungeon Generator to the Mask port.
    • Set the Overlay Logical ID parameter to 0 (Void) or 1 (Floor). This ensures the world's tiles don't overwrite the space where your dungeon rooms are.
  2. Connect Placements: Connect the Placements output of the Dungeon Generator node to the Output node's Prefab Placements port.
  3. Generate: Click Generate on your scene's WorldGenerator object.

Final Output Graph

Result

You should now see a vast procedural landscape with perfectly integrated, hand-crafted dungeons spawned at semi-random intervals!

Combined World and Dungeon