Dungeon Crawler Level Generation

Minecraft builds whole worlds without artists or landscapers. The game itself digs caves, raises mountains, and plants trees with only the guiding of numbers and an algorithm.

Of course, it wasn't the first game to generate a world, nor the last.

How do these algorithms work? What sort of rules are needed to create a world where a player can explore? What about a world that a player wants to explore?

More than just random

I've had opportunities in the past to use random numbers while making objects, but it was limited. It was always picking random values for specific attributes.

I might create 100 user accounts with fake names and emails to test a dashboard. Or I could spawn a sword that does Math.ceil(Math.random()*10) points of damage. Maybe just pick a random color.

That sort of randomness can add variety to an otherwise boring pattern but it hardly creates anything surprising or worth exploring.

Yearning for learning

Back in 2015 I read Adn's Gamasutra post on a Procedural Dungeon Generation Algorithm.

I was fascinated by the emergent structure and animations that showed each step of the evolution. That article sparked my interest in exploring the HTML5 canvas. Unsurprisingly I came back a year later to try my own implementation.

Level generation demo