Skip to content

Core Concepts: Archetypes

What is an Archetype?

Think of an Archetype as a set of rules or a "style guide" for a specific section of your dungeon layout. While Tile Sets define which tiles are available (the palette), Archetypes define how DunGen should behave when building a segment using those tiles.

Specifically, an Archetype controls:

  • Which Tile Sets to use for placing tiles in this section.
  • How optional branches should behave (how many, how long).
  • How much DunGen should try to keep the path straight.

How are Archetypes Used?

Archetypes are primarily assigned to the line segments connecting nodes within the Dungeon Flow graph. When DunGen generates the tiles corresponding to that line segment (either on the main path or branches originating from it), it uses the rules defined in the assigned Archetype.

This allows you to easily create distinct sections within your dungeon – perhaps a crypt section that branches frequently using "Crypt" tiles, followed by a straighter castle corridor section using "Castle" tiles.


Creating an Archetype

You create Archetype assets directly in your project:

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

Inspector Settings

Selecting an Archetype asset reveals its configuration options in the Inspector:

General

  • Branching Depth (Min/Max): Defines the minimum and maximum length (number of tiles) for any individual branch path that originates from a tile within this Archetype's section.

Guideline, Not Strict Limit

The minimum value is a target, not a guarantee. If DunGen cannot place a branch of the minimum length due to collisions or other constraints, it may create a shorter branch or no branch at all. The maximum value is respected.

  • Branch Count (Min/Max): Defines the minimum and maximum number of branch paths that can originate from any single tile on the main path while DunGen is processing this Archetype's section.

Per-Tile vs Global

This setting is used when the Dungeon Flow's Branch Mode is set to Local. If set to Global, the branch count is managed across the entire dungeon by the Dungeon Flow asset itself.

Guideline, Not Strict Limit

Similar to Branching Depth, the minimum value is a target. DunGen might not be able to place the minimum number of branches from every tile if space is constrained.

Path Straightening

All settings in this section can be optionally overridden from the Dungeon Flow asset by checking the checkbox next to each field. If the box is unchecked, the default values from the Dungeon Flow will be used instead.

  • 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?

Tile Sets

  • List of Tile Sets: This is where you specify which Tile Sets DunGen should use when selecting tiles for this section of the dungeon (both main path and branches).
  • Adding Sets: Click "Add New" and drag a Tile Set asset from your Project view into the slot.
  • Selection: DunGen will consider all tiles within all the listed Tile Sets, respecting their individual weights, when choosing the next tile for this section.

Branch Cap Tiles

This section allows you to define specific tiles that should be used as "dead ends" or caps for branch paths generated within this Archetype.

  • Branch Cap Type: Controls how the Branch-Cap Tile Sets (below) are used:
    • Instead Of: Only tiles from the "Branch-Cap Tile Sets" list below will be considered for the final tile of a branch. The main "Tile Sets" list (above) is ignored for this last tile.
    • As Well As: Tiles from both the main "Tile Sets" list and the "Branch-Cap Tile Sets" list are considered for the final tile of a branch.
  • Branch-Cap Tile Sets: A list of Tile Sets specifically designated for use as branch caps. Click "Add New" and assign Tile Set assets here.

Length Dependent

DunGen tries to use these caps, but if a branch path ends up being shorter than the configured Branching Depth (due to collisions, etc.), the final tile might not necessarily come from this specific list.


Purpose and Use Cases

Archetypes are powerful tools for:

  • Defining Thematic Sections: Assign different Archetypes with different Tile Sets to consecutive lines in your Dungeon Flow to transition between visual styles (e.g., cave entrance -> crypt -> lava caverns).
  • Controlling Complexity: Create Archetypes with high branching settings for maze-like areas, and others with low/zero branching for straightforward corridors.
  • Pacing: Use Archetypes with simpler tiles and fewer branches early in the dungeon flow, and introduce more complex ones later.
  • Defining Branch Content: Ensure branches use specific types of tiles (e.g., only "SecretRoom" tilesets for branches in a certain section).

By combining Archetypes with Tile Sets and arranging them in the Dungeon Flow graph, you gain significant control over the structure, style, and complexity of your generated dungeons.