SkillAgentSearch skills...

TaurusDungeonGenerator

A graph based procedural dungeon generator for Unity

Install / Use

/learn @SolAnna7/TaurusDungeonGenerator

README

<img src="Logo/taurus_logo_text.png" title="TaurusDungeonGenerator" alt="TaurusDungeonGenerator logo">

TaurusDungeonGenerator v0.8

A graph based procedural dungeon generator for Unity

<img src="https://drive.google.com/uc?export=download&id=1-3jRCGoPvjlY8IjOC1aHHUP6srYBUTD6">

Features

  • Abstract graph structure definition
  • Store and load structures from config with <a href="https://github.com/SolAnna7/PiscesConfigLoader">PiscesConfigLoader</a>
  • Quick layout generation (not using Unity space!)
  • Reusing dungeon plans by nesting
  • Main path and branch generation
  • Add meta data using tags and properties
  • Optional paths
  • Margin between elements
  • Debug view

System Requirements

  • Unity 2018.4 or later

Dependencies

Installation

  • Clone into the Assets folder of your Unity project
git clone git@github.com:SolAnna7/TaurusDungeonGenerator.git
cd TaurusDungeonGenerator/
git submodule update --init --recursive
  • ~~Download from Unity Asset Store~~
  • To load the dungeon structures from config files use the PiscesConfigLoader

Usage

Create your room assets
  • Add the Room component to the root <img src="https://drive.google.com/uc?export=download&id=1-KCNRDNO5NgeoN5nkYQvBieeQrRgN9B2" title="Room capture" alt="Room capture">
  • Setup your doors with RoomConnector component <img src="https://drive.google.com/uc?export=download&id=1qkYcCmzJytn2J1knEM4AeBe93nmD38Sg" title="RoomConnector capture" alt="RoomConnector capture">
  • Collect your rooms into RoomCollection-s for randomized usage
Define your dungeon structure
  • In code
 AbstractDungeonStructure.Builder
     .SetEmbeddedDungeons(new Dictionary<string, AbstractDungeonStructure>
     {
         {
             //branch type 1 definition
             "inline-branch-1",
             AbstractDungeonStructure.Builder.SetStartElement(
                 ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(4, 7))
                     .AddSubElement(
                         NodeElement("DungeonGenerationTest/MiddleRoom")
                     ).Build()).Build()
         },
         {
             //branch type 2 definition
             "inline-branch-2",
             AbstractDungeonStructure.Builder.SetStartElement(
                 ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(2, 5))
                     .AddSubElement(
                         NodeElement("DungeonGenerationTest/CorrX")
                     ).Build()).Build()
         }
     })
     .SetBranchData(new BranchDataWrapper(
         // the types of dungeons used as branches
         new List<string> {"inline-branch-1", "inline-branch-2"},
         // maximum percentage of empty connections where branches will be built
         50f))
     .SetMetaData(StructureMetaData.Builder
         // meta data objects for the structure
         .AddStructureProperty("name", "Realistic dungeon layout")
         .AddStructureProperty("description", "A realistic layout with one miniboss room, one boss room and one to three exits.")
         // tags for the structure
         .AddStructureTag("structure-tag-1")
         .AddStructureTag("structure-tag-2")
         // tags for every element
         .AddGlobalTag("global-node-tag-1")
         .Build())
     // the actual structure of the dungeon graph
     .SetStartElement(
         // a single room chosen from the DungeonGenerationTest/EndRoom RoomCollection
         NodeElement("DungeonGenerationTest/EndRoom")
             // tags for this node
             .SetMetaData(NodeMetaData.Builder.AddTag("entrance").Build())
             .AddSubElement(
                 // a sequence of connected rooms chosen from the DungeonGenerationTest/Corridors RoomCollection
                 // the length of the sequence is between 5 and 10 rooms randomly chosen at generation
                 ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                     .AddSubElement(
                         NodeElement("DungeonGenerationTest/MiddleRoom")
                             .SetMetaData(NodeMetaData.Builder.AddTag("small-boss-room").Build())
                             .AddSubElement(
                                 ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                                     .AddSubElement(
                                         NodeElement("DungeonGenerationTest/CorridorsNormalBig")
                                             .AddSubElement(
                                                 ConnectionElement("DungeonGenerationTest/CorridorsBig", new RangeI(3))
                                                     .AddSubElement(
                                                         NodeElement("DungeonGenerationTest/BigRoom")
                                                             .SetMetaData(NodeMetaData.Builder.AddTag("big-boss-room").Build())
                                                             .AddSubElement(
                                                                 NodeElement("DungeonGenerationTest/CorridorsNormalBig")
                                                                     .AddSubElement(
                                                                         ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                                                                             .AddSubElement(
                                                                                 NodeElement("DungeonGenerationTest/MiddleRoom")
                                                                                     .AddSubElement(
                                                                                         ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                                                                                             .AddSubElement(NodeElement("DungeonGenerationTest/EndRoom")
                                                                                                 .SetMetaData(NodeMetaData.Builder.AddTag("exit-1-static").Build())
                                                                                                 .Build())
                                                                                             .Build())
                                                                                     .AddSubElement(
                                                                                         ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                                                                                             // this part of the tree is optional
                                                                                             .SetMetaData(NodeMetaData.Builder.SetOptionalNode().Build())
                                                                                             .AddSubElement(NodeElement("DungeonGenerationTest/EndRoom")
                                                                                                 .SetMetaData(NodeMetaData.Builder
                                                                                                     .AddTag("exit-2-optional")
                                                                                                     // end of an optional tree
                                                                                                     .SetOptionalEndpoint()
                                                                                                     .Build())
                                                                                                 .Build())
                                                                                             .Build())
                                                                                     .AddSubElement(
                                                                                         ConnectionElement("DungeonGenerationTest/Corridors", new RangeI(5, 10))
                                                                                             .SetMetaData(NodeMetaData.Builder.SetOptionalNode().Build())
                                                                                             .AddSubElement(NodeElement("DungeonGenerationTest/EndRoom")
                                                                                                 .SetMetaData(NodeMetaData.Builder
                                                                                                     .AddTag("exit-3-optional")
                                                                                                     .SetOptionalEndpoint()
                                                                                                     .Build())
                                                                                             )))))))))))
             .Build())
     .Build()
  • Or load from config files using <a href="https://github.com/SolAnna7/PiscesConfigLoader">PiscesConfigLoader</a>
 realistic-dungeon-layout-1:
   inline-nested:
     # branch type 1 definiti
View on GitHub
GitHub Stars52
CategoryDevelopment
Updated10mo ago
Forks6

Languages

C#

Security Score

92/100

Audited on May 23, 2025

No findings