
Procedural Dungeon Generation Algorithm - ingve
http://www.gamasutra.com/blogs/AAdonaac/20150903/252889/Procedural_Dungeon_Generation_Algorithm.php
======
karl_gluck
If anyone's interested, there is a Reddit post explaining this and an
interactive demo from 2 years ago:

[https://www.reddit.com/r/gamedev/comments/1dlwc4/procedural_...](https://www.reddit.com/r/gamedev/comments/1dlwc4/procedural_dungeon_generation_algorithm_explained/)

[http://tinykeep.com/dungen/](http://tinykeep.com/dungen/)

~~~
jere
More generally I would also recommend:
[https://www.reddit.com/r/roguelikedev](https://www.reddit.com/r/roguelikedev)

~~~
karl_gluck
That's a great resource! Thanks :)

------
mnem
Here's a link to the original dungeon generation demo that Phi Dinh posted
using this algorithm:
[http://tinykeep.com/dungen/](http://tinykeep.com/dungen/) (Flash required).

He kept an interesting blog about the development of Tiny Keep and added other
posts about improvements to the generation mechanics for the dungeons,
including this nifty one about generating locked areas that Ben Jones worked
on: [http://blog.tinykeep.com/2013/09/just-sneaky-quick-update-
fr...](http://blog.tinykeep.com/2013/09/just-sneaky-quick-update-from-us-
today.html)

------
carlisle_
I really like the idea to just use a physics engine as a means of randomizing
the layout. Smart, succinct, and easy to implement.

~~~
neolefty
I delighted in this article because of its opinions about what is easy and
what is hard. Physics engine: easy; of course you have one; everyone has a
physics engine. Graph data structure & algos: suggests a few places to find
one.

As an older programmer who is in the midst of retooling, I would assume the
opposite: graphs easy, physics hard. But that's what retooling seems to be all
about -- finding the new "easy" and learning it.

~~~
yoklov
A physics system good enough to support this is probably ~200loc. Probably
less if you cut out everything extraneous. All it is is AABB collision
detection+resolution, and then some update code.

I think the graph + graph algos would be trickier most of the time, but that
could just be since I've written the above code many, many times.

------
catpolice
I've been working on an algorithm to make more playable dungeons with included
puzzles (e.g. locked door/key quests etc.). The math is there to ensure
everything is solvable and relatively interesting (you're guaranteed to run
into a puzzle before you find all the elements you need to solve it, for
instance) but I got bored when it came time to make an example game to
illustrate how it works. I'll pick that back up at some point...

~~~
ashark
Ever play Yoda Stories or Indiana Jones Desktop Adventures?

They do something like that, but with self-contained tiles that are randomly
arranged, with some variation in _e.g._ key/item placement.

------
onion2k
One of the best maze generators I've ever seen was in the ZX Spectrum (Timex
in the US) game of Steve Jackson's Warlock of Firetop Mountain[1]. It's
brilliant, coming up with a maze full of rooms and doors, with no islands, and
relatively well placed monsters and items. And all in 48K of ram. Despite
browsing the source code a couple of times I've never figured out how it
actually worked.

[1]
[https://en.wikipedia.org/wiki/The_Warlock_of_Firetop_Mountai...](https://en.wikipedia.org/wiki/The_Warlock_of_Firetop_Mountain_\(video_game\))

------
smlacy
I've seen algorithms that produce results similar to this before, and I find
them lacking in any sort of feeling of purposeful design.

Dungeons are (in theory) built by intelligent people for a reason. There needs
to be distinct working, eating, socializing, farming areas. There needs to be
wider or thinner pathways between areas based on flow of people & goods.

A good starting place to look for amazing looking dungeons is to look at
people who play Dwarf Fortress, and how they build & organize their forts,
which are essentially dungeons.

Here are a few good links:

[http://discourse.stonehearth.net/t/slave-to-armok-god-of-
blo...](http://discourse.stonehearth.net/t/slave-to-armok-god-of-blood-dwarf-
fortress/2613)

[https://leelubutterfly.wordpress.com/2013/01/01/dwarf-
fortre...](https://leelubutterfly.wordpress.com/2013/01/01/dwarf-fortress-the-
ultimate-story-creator/)

etc. just google image search for "dwarf fortress" and you'll see a lot.

Good algorithmic dungeon design should take into account some of these
factors, like good city design would.

~~~
douche
Dungeons as portrayed in every video game ever are a fantastic concept. It's
not like there are actually anything like real dungeons outside of our
imaginations (digging through rock is hard). The closest real analogues would
probably be cave systems, like Carlsbad Caverns or Mammoth Cave, which are
formed by irregular natural processes.

~~~
jpreiland
the catacombs, perhaps? I've participated in and run more than a few dungeon
crawls in catacomb settings

~~~
riffraff
catacombs (at least those I have visited) have _really_ tiny living spaces,
and connections between rooms are basically holes.

This is somewhat far from the "the adventurers met a group of monsters in the
corridor" or "moria's halls".

