13 ms·
Related:- 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 syste
by jimsmart 10y ago
Related:-
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 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_biRkWXftAOf9 https://www.youtube.com/playlist?list=PLFt_AvWsXl0eZgMK_DT5_...
- jimsmart 10y agoReplying to myself to add an additional point: Lague's cave system doesn't try to avoid designs with back-tracking -- in fact because he joins the orphaned spaces to the main space, the resulting cave system has more dead-end caves in it. 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)