Creating Drunkard’s Walk Maps

Drunkard’s Walk produces very natural-looking caverns worn away by erosion. It works by randomly placing a drunken miner on a solid map. The miner digs randomly, carving pathways into the map. Eventually, the miner either passes out, exceeding their maximum number of turns, or exits the map. We then check to see if the map is ready by counting the number of open tiles. If it isn’t ready, we spawn another drunken miner until the map is sufficiently open. The algorithm’s name arises from the random nature of the drunken movement. The algorithm may be visualized as follows:

Get hands-on with 1200+ tech skills courses.