Procedurally generated dungeons

I finally got around to improving the way procedurally generated locations work. Now, locations can have a procgen tag, which causes the game to look for a default set of rules for generating the location when the player enters it. This lets me specify things like which dungeon generation algorithm to use, what tiles to use, which monsters to make present, and things like that.

Additionally, I can specify a list of overrides on a per-level basis, so I can make certain floors of a dungeon different. For example, the first few levels could be brick-and-mortar dungeons, before devolving into rock face caverns with their own colour scheme and different monsters present. Another option available to me is to specify a premade map, so I can have fixed points within a dungeon — boss chambers, alters, shops, or whatever. Within these premade locations, I can even specify which position and level within the dungeon an exit should take you to, so I can also make shortcuts around larger labyrinths. All this should let me build some more engaging dungeon locations.

Alongside this dungeon revamp, I added a couple of complimentary features: procedurally generated quests and quest-locked portals. BotLG is a little unusual in that monsters won’t attack the player; combat is only initiated by the player bumping into a monster themselves. Now, this would mean that you could carefully navigate your way to the bottom of a dungeon and never face any actual danger, which is ridiculous.

To help combat this, I implemented a flag on portals (like doors, staircases, etc., any tile that moves you to another location) that makes that portal only work if a specified quest has been completed. When you enter a dungeon floor, a quest template is picked from a list, and the conditions to complete it are adjusted based on the current difficulty level. Players can only use the stairs down to the next level once the quest is completed; if the player leaves the dungeon, the quest is abandoned.

I’m going to use this system to flesh out the Rat King’s Lair, the first procedural dungeon the player will come across, and then add in a couple more. I’m increasingly thinking I need to revamp the starting area so the player can more immediately jump into some dungeon crawling without having to find the Rat King’s Lair, which is a fair distance away from the player’s start location, and a little off the beaten track.