The Smol Dungeon banner image.
You feel compelled to go down...
Available Now!
Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917

Smol Dungeon Map Generation

As of Smol Dungeon v1.1 (the launch version) there are four flavors of map generation. This is a rich topic and there are loads of awesome map gen algorithms to read about online. This is just a smol sample of what's possible.

Rooms

If you're interested in map generation this is the algorithm to start with. You dig out a series of rectangular rooms and then connect them up with a series of hallways. For a classic look, don't allow the rooms to overlap. In Smol Dungeon rooms are allowed to overlap.

An animated graphic showing the rooms map generation algorithm.
Rooms Map Algorithm

Circles

The same idea as the rooms algorithm but with circles instead of rectangles. The circular shape combined with overlap creates more organic "cave-like" maps.

An animated graphic showing the circles map generation algorithm.
Circles Map Algorithm

Hallways

Monsters block your path in Smol Dungeon, so having narrow corridors can create quite tense situations for the player to resolve (or die from). We select a series of points and then join them up with some tunneling.

An animated graphic showing the hallways map generation algorithm.
Hallways Map Algorithm

Templates

Although procedurally generated levels are technically "limitless" they can end up having a very repetitive feel (hence three different proc gen map types). To further alleviate this we also have many pre-defined hand drawn maps. I drew most of these on paper and then translated to my very sophisticated tile map data structure.

            let ZIG_ZAG = """
            ############
            #..........#
            #..........#
            #########..#
            #########..#
            #..........#
            #..........#
            #..#########
            #..#########
            #..........#
            #..........#
            ############
            """
        
An animated graphic showing a template map being created.
Template Maps

Given Smol Dungeon's 10x10 map constraint, map generation for the game did not need to be more complex than these few procedures. A larger game would likely benefit from a more sophisticated approach. If you're working on a game I'd encourage you to try mixing and matching different procedures, e.g. a rectangular approach for dungeon levels and the circular approach for cavern levels.