Digger Dungeon Generator
Implementation of a digger dungeon generator
https://github.com/IQUELFergal/DiggerDungeonGenerator
This dungeon generator works like ants digging tunnels. Diggers can only explore a defined number of room and every digger starts at the spawn room (marked with an S).
To create a room, diggers pick a random direction to explore. If the cell as not been explored before, the digger coordinates (in grid space) is added to a list. Then diggers pick another random direction, and try to build another room.
When all of the diggers are done exploring, a grid cell array is generated representing all the room to generate. The algorithm then loops over it to create rooms. Each room knows its neighbor so we can use a graph structure to pick the farthest room from the spawn room and mark it as the boss room, represented by a skull.
I use textures to define room layouts. Each row represents a room design, so in order to create the dungeon tilemap, a random design is assigned to each room. The algorithm then chose the correct layout depending on the room neighbors with simple tile bitmasking. (see https://gamedevelopment.tutsplus.com/tutorials/how-to-use-tile-bitmasking-to-aut...). Each color on the texture represents a certain tile so the algorithm knows if each tile is a wall, a ground or a void tile. This system can be expanded to create enemy spawn tiles or item spawn tiles if needed. I just have to assign a color to the right tile and paint it on the texture to see it in the dungeon.This allows for quick customisation of the dungeon.
To create my tiles, I used 2d-extra unity package (https://github.com/Unity-Technologies/2d-extras) in addition to an auto ruletile creation tool (https://pandaroo.itch.io/tilemap-auto-rule-tile-unity-template) with a custom ground tileset.