An attempt at generating dungeons with Ruby

leoncodes00

Cha Yang

Posted on October 30, 2019

An attempt at generating dungeons with Ruby

I wanted to make a random world generation and dungeons are a great way to start. This is an attempt at generating dungeons so right now it's only able to generate the number of rooms, monsters, and percentage of treasures there are in that generated dungeon. There is a dungeon size you could choose between small, medium, and large. The larger the dungeon, the higher the chances of getting treasures but you're also at risk of getting a dungeon spawned with legendary monsters. The screenshot below is the monsters and legendary monsters array that I created. Right now it's not a lot, but it's a good start.

Alt Text

I haven't implemented a legendary monsters percentage yet but I am going to implement it later to spawn in a room with a certain percentage. The smaller the dungeon size, the less chance it'll spawn. The code is still really repetitive at this point, but I just want to see how it would feel like if it was working so that I could start doing the right things to get to that goal.

Alt Text

It's going to run in the terminal and the user input guides the world generation. Things such as would you want your dungeon to be small, medium, large, or custom in size. The dungeons are randomly generated so a small dungeon could be different from another small dungeon. It would still have the same percentage of treasure drops though which is the main attraction.

Alt Text

Overall, this is just the beginning of the project and the first attempt at random world generation. I plan to make it generate a lot more things for the dungeon but for now, just three is fine.

💖 💪 🙅 🚩
leoncodes00
Cha Yang

Posted on October 30, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related