Evan's Dev Blog

Capstone Chronicles


Generated, Part 1

I found a better way to generate a dungeon than whatever method I was doing before. Before I think I was focusing too much on the individual room which caused problems when it came to creating the whole dungeon. I did some research examining whatever algorithm I came across to see if it fit for what I was looking for. What I landed on and what I am using now for the project is Binary Space Partitioning (or BSP), which is used by partitioning a space into two subdivisions. There is an interesting read on how BSP was used for the 3D renderer of Doom 1993, but the way I used it here is a bit different. I am using it in I guess a more literal sense of giving the algorithm a space of a certain size and receiving a bunch of smaller spaces that fill in that same area. Basically we have the whole space as the root node of a tree and that space is split either horizontally or vertically (doesn’t have to be split down the middle). Each of those subdivisions are the two children of the root node and then each space is recursively divided again for however many iterations selected. Now there are borders within this area and walls and doorways can be placed to create the dungeon.

The resulting spaces of BSP are each a room of their own which means a room can be handled individually and a smaller section of rooms can be selected and removed/replaced (more on this is part 2). Another piece to look at is placing props within these rooms. The lore of the game allows for many rooms to be empty or have only a couple items, however as the game progresses new things are encountered and themes revealed leading to a more interwoven and filled world.

Next will be wrapping up the memory mechanic, replacing rooms and such, as well as adding some handmade rooms to serve as sort of anchors in the uncertain world.


css.php