Dugeon Generation

This dungeon generator generates a random grid based dungeon. This dungeon is based on the settings you put in beforehand.

Look at my code
  • GitHub
  • How it works.

    The dungeon starts at a start room. It will always spawn a room on each side of the spawn room.


    After this the spawned room has a random chance to spawn another room on each side of the room, if it does want to spawn a room on a side it checks if there already is a room on that side, if there is, it won't spawn a room. This happens on every spawned room. On spawning the room there is a random chance for that room to become a item or shop room if the max amount of those rooms is not already spawned. After spawning the room it will turn on a door on the side of the spawned room and turn on the door on the side of the current room on the spawned room.
    This will continue until the generation is done. After the generation it will spawn a boss room beside the farthest room from the spawn. After this it will check if all the conditions set before are met, of not the scene will reset until the conditions are met.

    (The dungeon conditions.)


    (The different rooms able to spawn and room spawn chances are saved in a scriptable object.)



  • Back