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—having exceeded their maximum number of turns—or exits the map. You then check if the map is ready by counting the number of open tiles. If it isn’t ready, you spawn another drunken miner until the map is sufficiently open. The algorithm’s name arises from the random nature of drunken movement. The algorithm may be visualized as follows:

images/MoreInterestingDungeons/DrunkardsWalkAlgorithm.png

Let’s start building a drunkard’s walk map.

Implement ...

Get Hands-on Rust now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.