A different way of generating a dungeon level

Dungeon
Image by Artie_Navarre from Pixabay

I talked previously on how I generated dungeon levels by splatting down squares and circles of random sizes and then linked them together by corridors.

But another way that might make levels look not quite so procedurally generated is to first compile a catalogue of dungeon rooms.  These are “hand drawn” in a master text file, perhaps something like this:

*****|****
*        *
=        *
*        =
*        *
*****|****

Where * marks the walls,| a possible location of a vertical running corridor and = the same for horizontal running corridor. Each entry in the catalogue has a size (vertical, horizontal) e.g. (6, 11) for the room above and the generator program has to find space for this and then see which of the four doors it can connect to.

You can decide if you want a dead end room or one with more doorways. Any unused doorways are just replaced with a * for wall. Single door rooms might have a secret door that the player has to first discover and unlock/open.

When the generator starts, it reads in the master file, builds a list of rooms and then starts using them to generate levels.

The advantage of the catalogue method is that you are free to create as many room sizes and shapes as you wish and they don’t have to be rectangular or square. Yes the level is procedurally generated but using this methods makes it look less so. You can have very small rooms (2 x 2 anyone?)  or massive hallways with lots of columns.

Leave a Reply

Your email address will not be published. Required fields are marked *