Skip to content

Getting Started

This is a quick getting-started guide for the dungeon generator. There is more info on the Details page.


How it works

The dungeon generator takes room prefabs and puts them together at connectors to build a dungeon.

Simplified generation flow:

  1. Spawn a starting room.
  2. Look at its connectors.
  3. For each connector, pick a room from a list.
  4. Place it so the connectors line up.
  5. Repeat until we hit the size limit or run out of valid spots.

Minimum requirements

To see anything generate, you need:

  • At least one room prefab
  • That room needs at least one connector
  • A WeightedList that tells connectors which rooms they are allowed to spawn
  • A DungeonGenerator in the scene that knows about your starting room

Step 1 - Make a basic Room

  1. Create a new GameObject in the scene (for example: TestRoom).
  2. Add the Room component.
  3. Build some simple geometry under it (floor, walls, whatever).
  4. Edit the BoundingArea component and make sure it roughly covers the whole room.

Turn it into a prefab once you’re happy with it.


Step 2 - Add Connectors

Connectors are where new rooms can attach.

  1. Inside your room prefab press "Add Connector" on the Room component. This automatically creates a connector and adds it to the connector list. You can also do this manually by creating a GameObject, adding the connector component and adding it to the list on the room component.
  2. Position and rotate it so its forward direction points "out" of the room (where the next room should appear).
  3. Add at least 2 connectors.

A room needs a minimum of one connector. But if a room only has one connector it will become a dead end since one connector will always be used as the entrance.


Step 3 - Create a WeightedList

To assign what rooms a connector can generate it needs a WeightedList that defines the rooms and the chance of it appearing. The WeightedList is a scriptable object that has a list of GameObjects and a weight associated to them.

  1. In the Assets window, create a new WeightedList by right-clicking and choose Create -> VixDungeonGen -> WeightedList
  2. Open it and add your room prefab with weight 1.

Step 4 - Hook it up to the connector

  1. Open your room prefab.
  2. Select the connectors.
  3. Assign the WeightedList you just created.

Now the connector knows which room(s) it is allowed to spawn.


Step 5 - Add the DungeonGenerator

  1. Create an empty GameObject in the scene (for example: Dungeon).
  2. Add the DungeonGenerator component.
  3. Set Starting Room to your room prefab.
  4. Set a max size / room count (for example: 20).

You can leave most other settings at their defaults for now.


Step 6 - Generate the dungeon

Press Generate

If everything is set up correctly, the generator will:

  • Spawn your starting room.
  • Use its connectors to place more rooms.
  • Stop once it reaches the max size or can’t place more.

There are different settings for how the generation is handled. It can be spread out frame by frame or instant depending on the Generation Speed setting.


Where to go from here

A few ideas once the basics work:

  • More room prefabs - corridors, T-junctions, bigger rooms, etc.
  • Multiple WeightedLists - one for "normal" rooms, one for special ones.
  • Tweak Connector Order - change how the dungeon grows (more branches vs long corridors).
  • Add doors & WallPlugs between rooms - connectors can generate doors by adding a prefab to the connectors door list. Wallplugs can also be placed at unused connectors to plug holes. Since this is done per connection I suggest making your connectors prefabs.

For more info, check the Details documentation.