A small showcase of how to generate random 2D caves using a cellular automaton. Inside the code there are some parameters worth tweaking, maybe I'll add an interface for this in a later update.
The automaton is really simple: it changes based on the majority of it's neighbours and remains unchanged when tied.
- width and height - self explanatory, cave will be displayed in the upper-left corner
- live and text color - coloring of the cave and the "reset" message
- iterations - more iterations of the automaton mean less small noise and more smooth walls. Over 20 will not change much.
- density - chance of a cell being dead at the start. Very susceptible to change, more will create wider corridors.
More on density:
- less than .30 - will create an almost full array of live cells, not very cave-ish
- .30 - .45 - many small caves, walls are a majority
- .45 - .50 - a couple separate caves with many small holes around
- .50 - .53 - a quickly increasing chance of forming one connected cave consisting of long thin corridors
- .53 - .60 - tables have turned, now the walls are just blobs in the empty space around them and they're getting more and more sparse
- .60 - .70 - an empty room dotted with rare live cells
- .70 and up - hardly any cells survive first few iterations, only live cells end up at the walls since out of bounds is always considered live
P#83128 2020-10-19 20:29 ( Edited 2020-10-19 20:32)
Now I just want to go run around and explore these ;\
P#83151 2020-10-20 02:36
@SmellyFishstiks I will be making a cave-exploring roguelite based on these, but I expect it to take a looooooong time to get finished
P#83158 2020-10-20 07:32
@SmellyFishstiks the game is currently shared as a Work in Progress cart on bbs.
P#83453 2020-10-29 10:25
[Please log in to post a comment]