How my map generation is going so far.

I joined the Roguelike-jam 2022! I also screwed up my sleep-cycle so I’m writing this at about 04:30 UYU Time.

Initially I was going to just sort of clone the algorithm I made for my previous dungeon-ish game, Abstract Terror Strike, but I wasn’t entirely happy with it. While reading up about map generation (got some fun island making algorithms too but I couldn’t fit that in with the theme), I found this custom building generation algorithm: Real-time Procedural Generation of ‘Pseudo Infinite’ Cities.

The basic working of it (please do read it! It’s pretty interesting and does some amazing work for a 2003 paper) is to generate a set of building primitives, calculating the union of them for each floor and removing the last one when building each successive floor. This makes for pretty organic looking buildings, and some fun “dungeons”, to which I had to add some checks to make sure it always remained connected and didn’t overlap. Forcing floors to always be continuous might not be necessary but I didn’t really want the player to deal with backtracking. For an example of how it looks, see this image: Generated building The original paper is far better, with less angled buildings but I couldn’t get circle mask generation to work quite right. Texturing I didn’t quite get from the paper either but it does explain how they calculate mapping to a preexisting texture.

Then, I need to split up each floor into rooms. The way I went about this, although it didn’t really work out as I hoped, is to traverse every available block from top-left on, trying to group up rows of the same size, so that for example a small extrusion from the building would be its’ own room separated from the rest of the building. Didn’t really work out but it’s a nice starting point, see the following picture: Segmented rooms

Both of these systems can be improved in quite a couple of ways, but I’m happy with this as a starting point. The next couple of challenges are to make connections between rooms (probably just a matter of finding all block pairs where one is in a room and another is in another), staircase positioning and such. The last one was an issue for me on ATS because it tended to sometimes generate a locked door before the chest that had its’ key, which i solved by placing all chests on the left side of the room and locked doors on the right side, but that makes for a pretty shallow challenge and wouldn’t work very well on a not rectangular dungeon.

Thanks for reading! I will continue to write about my progress in this game.