Log In  

Dungeon Layout Generator

Cart #yositimosa-1 | 2019-05-19 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Cart #yositimosa-0 | 2019-05-16 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA


A generator based on this cart by @johanp. It uses a similar idea to place rooms, but is much more simplistic (I prefer to try and figure things out on my own before I dig into other people's code.) This particular version continuously generates new dungeons while running. Feel free to reuse this if you like.


+Added some statistics about generators.
+Fixed some issues with rooms becoming isolated (I think)
+Randomized the variables rooms are generated with every loop to better showcase the generator.

P#64462 2019-05-16 19:44 ( Edited 2019-05-19 02:01)

Looking good!
How are you deciding when to shrink the room size?

P#64465 2019-05-16 19:48

@johanp: Right now it increments a counter for each room every frame and when that reaches 30, it shrinks the room in either x or y dimension by 1 and resets. If either reaches 0, the room is deleted, but it should probably shrink to 1-1 size before deleting instead.

P#64466 2019-05-16 19:50


P#64467 2019-05-16 20:15

Love it! Though I did witness one generated dungeon where a room was placed in the top right corner and not connected to any other room.

Seems like a very rare event, only happened once and I watched it a while.

I'm like you, I don't like to use too much of other people's code, it's fun to try by yourself and you learn something.

If I ever make a roguelike I might try this method.

P#64506 2019-05-17 11:45

@RetroWolf: Thanks for letting me know! I think I have a fairly easy solution for that...I will upload a new version tomorrow with some improvements.

P#64535 2019-05-18 03:04

[Please log in to post a comment]