Procedural Dungeon Generation: Cellular Automata
blog.jrheard.com
Procedural Dungeon Generation: Cellular Automata
1–10 of 16 posts
Re: Procedural Dungeon Generation: Cellular Automata
#2However, the Future Work [0] section sort of points out the hardest part of all this. Avoiding back tracking.
Last time I attempted something like this, the only solution I could come up with was running a second automata, designed to generate small dead links between large groups of dead cells.
I was terribly impressed with the results.
Kyzrati's guided generation seems interesting, but my immediate thought is how linear it makes the caves - almost too much, which was the complaint against Skyrim's caves by more experienced players. But by the same token, it was precisely what more casual players liked about Skyrim's cave systems.
[0] http://blog.jrheard.com/procedural-dungeon-generation-cellul...
Re: Procedural Dungeon Generation: Cellular Automata
#3Re: Procedural Dungeon Generation: Cellular Automata
#4Heads up, passing 0 as first parameter to generate-grid makes the javascript on the page to freeze, at least on Safari (maybe an endless loop).
Re: Procedural Dungeon Generation: Cellular Automata
#5In the more organic portions of my current project, I'm definitely using something like this :)
Re: Procedural Dungeon Generation: Cellular Automata
#6As a hobbyist gamedev and world builder, I love stuff like this. Kudos for making everything interactive. It really helps the learning/"aha!" process to be able to change things on the fly as you're reading about it, rather than having to roll your own to follow along. In the more organic portions of my current project, I'm definitely using something like this :)
I'm hopeful that we'll see lots more blog posts written in this interactive style in the future - the KLIPSE plugin I use is extremely simple to set up, and has support for a ton of languages including Python and Ruby (not to mention regular old JavaScript!). http://blog.klipse.tech/klipse/2016/09/09/klipse-languages.h... is a gallery page that has examples of all of the languages that the plugin supports.
Re: Procedural Dungeon Generation: Cellular Automata
#7There's a great set of Unity3D tutorials by Sebastian Lague [0] that use cellular automata (and a few other tricks) to create a procedural cave system.
The initial cave creation technique is nigh identical to this article (purely because both use cellular automata).
Lague then joins orphaned spaces to the main space via shortest paths, using a rough Bresenham line-draw through the in-between cells (plotted with a 'brush' that is wider than one cell, so the path is traversable).
He then creates a smoother polygonised 2d/3d mesh from this grid of cells using marching cubes/squares.
The end result is quite pleasing, and fairly tweak-able :)
Both Lague's approach and his code are quite clean, so I expect the process could easily be ported to other languages / frameworks.
[0] https://www.youtube.com/playlist?list=PLFt_AvWsXl0eZgMK_DT5_...
Re: Procedural Dungeon Generation: Cellular Automata
#8A non-interactive page about the same topic I'd have either had to set up my own environment for this or I'd have moved on without really toying with the values. Instead I've already found a way to get results that would satisfy me with fewer cycles spent.
Re: Procedural Dungeon Generation: Cellular Automata
#9Related:- There's a great set of Unity3D tutorials by Sebastian Lague [0] that use cellular automata (and a few other tricks) to create a procedural cave system. The initial cave creation technique is nigh identical to this article (purely because both use cellular automata). Lague then joins orphaned spaces to the main space via shortest paths, using a rough Bresenham line-draw through the in-between cells (plotted…
But that said, during the creation process one could easily track these spaces-that-were-previously-orphaned, and could easily use that list to spawn specials in these rooms (e.g. make the dead-end caves into features instead of bugs, by placing goals/treasure/sub-bosses/etc in them)
Re: Procedural Dungeon Generation: Cellular Automata
#10The other classic algorithm that I've gotten the most mileage out of is: http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_... . Using rooms the size of entire subdivisions (instead of the smaller ones on that page) makes a nice contrast with the cellular cave algorithm.
The only algorithm I've come up with that's nearly as nice as these two is competitive flood fill. First you randomly pick center points for rooms, create a priority queue of [distance to room center -> room + tile], and add the room centers to the queue. Then you repeatedly pop tiles, add them to the corresponding room, and add their neighbors to the queue, until all tiles are in rooms. This is basically a discrete version of a voronoi diagram, but the trick is that implementing it this way allows you to safely mix different ways to measure distances, and you get wild shapes when some rooms use manhattan distance and others use euclidiean distance. (Some day I'll do a proper writeup of this, but not today.)