Heroic Engine
  • Welcome
  • Getting Started
    • Quickstart
    • Example Games
      • Tic Tac Toe
      • Turn based duel
  • Basics
    • Injection Manager
    • Engine Systems
      • Core Systems
        • Events Manager
        • Input Manager
        • Localization Manager
          • LangText component
        • Music Player
        • Sounds Manager
        • Time Manager
        • Scenes Loader
        • Day Time Controller
        • Weather Controller
      • Gameplay Systems
        • Currencies Manager
        • Player Progression Manager
        • Quest Manager
        • Random Events Manager
        • Hittables Manager
        • Dungeon Generator
      • UI Systems
        • UI Controller
        • Countdown Controller
    • Editor Tools
      • Clear Saves
      • Mobile Build Optimizer
      • Create System
      • Icon from Prefab Generator
    • Engine Utilities
      • PoolSystem
      • DataSaver
      • ComponentExtensions
      • MaterialExtensions
      • SpriteUtils
      • SlowUpdate
      • StringUtils
      • TypeUtility
      • MathHelper
      • VectorUtils
      • TransformUtils
      • MeshUtils
    • Useful Components
      • Floating Item
      • Fly Up Text
      • Label Scaler
      • Ragdoll
      • Rotate To Camera
      • Orbital Camera
      • Rotator
      • Texture Mover
      • Hittable
      • Projectile
      • Projectile2D
      • LifetimeObject
      • Spawner
      • Colorized Particles
      • Draggable2D
      • SaveableTransform
    • Useful Attributes
Powered by GitBook
On this page
  • Parameters in inspector
  • Available methods
  1. Basics
  2. Engine Systems
  3. Gameplay Systems

Dungeon Generator

PreviousHittables ManagerNextUI Systems

Last updated 4 months ago

Presented by IDungeonGenerator interface, this system allows to generate dungeons of needed size and complexity by maens of BSP algorithm.

To use it, you can just drag DungeonGenerator prefab onto your game scene and set it up as you want.

Parameters in inspector

Floor Tile Prefabs – list of floor tile prefabs. You can add your own tiles here, they should be gameobjects with width and length equal to 1 unit, height can have any value.

Wall Tile Prefabs – list of wall tile prefabs. You can add your own tiles here, they should be gameobjects with width and length equal to 1 unit, height can have any value.

Enable Walls – if set to true, walls will be generated, otherwise, dungeon will be only with floor tiles.

Dungeon Width – width of dungeon, 50 units by default.

Dungeon Length – length of dungeon, 50 units by default.

Min Room Size – minimal room size in units.

Max Iterations – max number of rooms splitting iterations.

Room Margin – margin between rooms in units.

Corridor Width – typical width of corridor in units.


You can also use its functionality via code. For this, inject IDungeonGenerator interface into your class.

Available methods

List<DungeonRoom> GenerateDungeon(Vector3 pos)

This method generates dungeon with default settings set in DungeonGenerator inspector.


List<DungeonRoom> GenerateDungeon(Vector3 pos, int width, int length)

This method generates dungeon with default settings set in DungeonGenerator inspector, but with custom width and length.


List<DungeonRoom> GenerateDungeon(Vector3 pos, int width, int length, 
    bool enableWalls = true, int minRoomSize = 5, int roomMargin = 2, 
    int maxIterations = 5)

This method generates dungeon with custom settings.

Example:

dungeonGenerator.GenerateDungeon(playerPos, 40, 40, true, 6, 2, 4);

void ClearDungeon()

This method clears current dungeon. Automatically called when new dungeon is being generated.


void GenerateNavMesh()

This method generates NavMesh for current dungeon.

Dungeon generation
DungeonGenerator prefab
Parameters in inspector