Core Concepts: Tile Sets
What is a Tile Set?
Tile Sets are essentially named groupings or collections of your Tile prefabs. Think of them as palettes or inventories of rooms and corridors that DunGen can draw from during generation.
Their main purpose is to help you organize your tiles and control which specific sets of tiles can be used in different parts of your dungeon or for different structural roles.
Tile Sets vs. Archetypes
It's important to understand the difference:
- Tile Set: A collection of Tile prefabs
- Archetype: A set of rules defining a section of the dungeon (branching behaviour, length, etc.) which uses one or more Tile Sets
You can create as many Tile Sets as you need to categorize your content effectively.
How are Tile Sets Used?
Tile Sets act as the source for Tile selection in several key areas of DunGen:
- Dungeon Flow Nodes: You assign Tile Sets directly to the Start, Goal, and any intermediate Nodes in your Dungeon Flow graph. This dictates which specific tiles can be used for those critical single-tile placements.
- Archetypes: Archetypes define which Tile Set(s) should be used when generating the segments of the dungeon they control (both main path lines and branches).
- Tile Injection: When using the Tile Injection feature, you specify a Tile Set from which the injected tile should be randomly chosen.
- Branch Caps: Archetypes allow assigning specific Tile Sets to use for the final tile at the end of a branch path.
Creating a Tile Set
You create Tile Set assets directly in your project:
- Right-click in the Project view.
- Navigate to
Create > DunGen > Tile Set. - Give your new Tile Set asset a descriptive name (e.g., "Crypt_Corridors", "Castle_LargeRooms", "StartTiles").
Inspector Settings
Selecting a Tile Set asset reveals its configuration options in the Inspector:
Tile Weights
This is the main part of the Tile Set, where you list the Tile prefabs included in this collection and configure their selection likelihood.
- Adding Tiles: Tiles can be added in one of two ways:
- Click the "Add New Tile" button. Drag a Tile prefab from your Project view into the "None (GameObject)" slot that appears.
- Drag a Tile prefab from your Project view directly onto the "Add New Tile" button.
- Weights per Tile: Each Tile entry has its own weight settings:
- Main Path: The base chance of this tile being chosen when this Tile Set is used for the dungeon's main path.
- Branch Path: The base chance of this tile being chosen when this Tile Set is used for an optional branch path.
- Depth Scale: A curve that modifies the Main/Branch path weight based on the tile's normalized depth (0=start, 1=end) along the current path.
- (For a full explanation of how these weights interact, see the Weighting page).
Tile Reusability
A single Tile prefab can be included in multiple different Tile Sets, potentially with different weights in each set. This is great for organization (e.g., a standard corridor might be in both "Crypt_Corridors" and "Castle_Corridors" Tile Sets).
Locked Door Prefabs
This section allows you to define which prefabs DunGen should use when it needs to place a locked door involving a Tile from this Tile Set. This is part of the Lock & Key System.
- Adding Entries: Click "Add" to create a new entry for a specific Doorway Socket type.
- Socket Type: Select the Doorway Socket asset this entry applies to from the dropdown.
- Prefab Weights: Click "Add New Prefab" within the socket entry. Drag your locked door prefab(s) here.
- If you add multiple prefabs for the same socket type, their individual weights determine the chance of each one being chosen when a locked door of that socket type is needed.
Common Use Cases
- Start/Goal Rooms: Create Tile Sets like "StartRooms" and "GoalRooms" containing only the specific prefabs suitable for the dungeon's entrance and exit, then assign these to the Start/Goal nodes in the Dungeon Flow.
- Thematic Sections: Organize tiles by visual theme (e.g., "CryptTiles", "CaveTiles", "CastleTiles") and assign them to different Archetypes used along the Dungeon Flow graph.
- Structural Roles: Separate corridors from rooms (e.g., "CorridorSet", "RoomSet") to potentially use different Archetype rules or weights for each.
- Difficulty Tiers: Create Tile Sets for different challenge levels (e.g., "EasyRooms", "HardRooms") and use weights or the Dungeon Flow to introduce harder rooms later in the dungeon.
By effectively using Tile Sets, you gain precise control over which pieces DunGen uses where, enabling better organization and more structured procedural generation.