Hello, and welcome to the White Crow Devblog. On this blog I’ll be showing my progress as I create a hybrid between the horror and roguelike genres (or a horror roguelite if you prefer). It will be a game about investigating strange supernatural phenomena, discovering the nature of a supernatural threat and confronting it. The threat will be newly procedurally generated each game and the player will have to investigate.

However, that’s still to come. What I’ve been working on so far is the generation of the buildings the player will be investigating. While procedural generation has become quite common, it is mostly used to create dungeons, caves, and landscapes, rather than coherent internal areas. I want to create buildings that feel like buildings, in order to create a sense of reality and therefore to make the contrast between the mundane and the intruding supernatural more striking.

One of the reasons that it is difficult to generate good interiors is that all space in the building must be filled as well as separated into distinct areas. The interior must also be navigable and contain everything needed for the functions of different areas. This is made even trickier in my case by creating the building in actual 3D space rather than just on a grid. No moving through corners on the diagonal for me!

My first attempt to create interiors began at the lower left corner of the building, and created a room of random size. It then picked the grid cell closet to the lower left corner that hadn’t already been placed in a room and created a room starting there, and repeated the process until the whole building was filled. This method always had issues with creating the rooms at the top or right of the building, and when I tried to find a method to assign functions to rooms (designating them as bathrooms and kitchens for example), I realized this whole scheme was a dead end.

I decided to do some research into the topic and discovered that, fortunately, I wasn’t the only person trying to crack this problem. A team of Dutch computer scientists had worked out a possible method. You can read their paper here, but I’ll summarize the important principles. The Dutch method starts with a nested list of Regions and the basic shape of the building. The regions are divided into sets, and all regions except the first set will have a “shallower” region they exist within. For example, I divide houses into public and private regions, and bedrooms can only exist in private areas. Obviously the program must do the “shallower” regions before the “deeper” ones. For each level of depth, the program selects an appropriate cell as the center of each region and then expands the regions to fill out the area assigned to that set of regions. The deepest regions will become the actual rooms used in gameplay.

The strengths of this method are that it fills the entire area in a reasonable way, and can be easily adapted to generate many different kinds of building with the same code. Just feeding in a different set of regions can create everything from hospitals to townhouses.

Next week I’ll discuss how I put some meat on the data bones of these buildings. Doors, furniture, stairs, and multiple floors await!