Tutorial 4: Validating Your World with Diagnostics
In this tutorial, you will learn how to use the Map Diagnostics tool to ensure your generated caves or dungeons are actually traversable by a player.
The Scenario
You have generated a cave system using Tutorial 1, but you want to be 100% sure that the player can walk from the entrance to the exit without getting stuck behind a wall of procedural noise.
Step 1: Open the Tool
- Generate your world in the scene.
- Go to Window > Dynamic Dungeon > Map Diagnostics.
- Click Add Selected to link your
WorldGeneratorobject to the tool.
Step 2: Define "Walkable"
We need to tell the tool which tiles are solid.
- In the Walkability Rules section, enable Auto-Block Collider Tilemaps.
- If your walls don't have colliders yet, enable Use Tilemap Layer Rules:
- Add your
Wallslayer. - Set the mode to Block Any.
- Add your
note
Space for Screenshot: Configuring Walkability Rules in the Diagnostics Window.
Step 3: Test a Path (A*)
- Set the Active Tool to
AStar. - Click the Pick Start button. In the Scene View, click on the floor where the player starts.
- Click the Pick End button. Click on the floor where the exit should be.
- Click Run Diagnostic.
Interpreting the Result
- If a Green Line appears, the path is valid!
- If the console says "Path Not Found", your generation logic has created a blocked path. You may need to adjust your noise threshold or cellular automata iterations.
Step 4: Check for Islands (Flood Fill)
Isolated islands are areas the player can see but never reach.
- Change the Active Tool to
Flood Fill. - Ensure your Start point is in the main playable area.
- Click Run Diagnostic.
- A heatmap will appear. Any area that remains grey/uncoloured is unreachable.
note
Space for Screenshot: A Flood Fill result showing a main cave in blue and unreachable pockets in grey.
Step 5: Optimisation Tip
If your generation is large (e.g., 500x500), diagnostics can take a few seconds.
- Enable Use Physics for faster checks if you have a
CompositeCollider2Don your tilemap. - The grid is cached; you only need to click Force Rebuild Grid if you manually paint tiles or change the world dimensions.