PDA

View Full Version : Random Cave Generation



RobA
12-04-2008, 10:26 PM
Inspired by isomage's efforts (http://www.cartographersguild.com/showthread.php?t=3571) at random cave generation I did a bit of research on random walks and came across this description (http://www.mit.edu/~kardar/teaching/projects/chemotaxis(AndreaSchmidt)/gradients.htm) on simulating bacteria using random walks with a gradient bias.

I turned to my trusty swiss army knife, processing (http://processing.org/) and cobbled together a random walk with gradient bias engine....then started building gradients to make gave maps.

My first experiment was just to verify the algorithm would follow random walk along the gradient from light to dark.

The gradient:
8192

and the walk:
8193

Then I came up with this perlin noise with a left to right bias map:
8194

which created this "cave" structure
8195

and here is a comparison showing the lineup:
8196

I think there could be some promise in this...

-Rob A>

isomage
12-05-2008, 02:02 AM
That does look promising. My maps are made by random walks -- three traces of two-dimensional fractional Brownian motion (http://en.wikipedia.org/wiki/Fractional_Brownian_motion) with different fractal dimensions and independent random skew. Your Perlin map looks like it could have been done with my generator; probably the gradient is providing skew, and the Perlin noise is effectively being summed over successive steps to produce Brownian motion -- the same general effect, but from a much more accessible procedure :)

Try compositing multiple walks with different gradients (direction and magnitude) and different noise fields, and you'll probably get results equivalent to mine.

Nicely done!

Steel General
12-05-2008, 06:33 AM
Cool stuff guys, even if I only understand a small portion of it. :)

Sagenlicht
12-06-2008, 06:57 AM
Hmm RobA, could you post your script? I downloaded processing and would like to see an example. Would make starting easier :) Processing really looks promising.

RobA
12-06-2008, 02:06 PM
The script is for the random walk, not the perlin noise generation :(

I have been building noise gradients in gimp and importing them....

I think there is a better way to do this, I think I'll create a gradient array from the image and switch the whole random walk to vector math...

-Rob A>