View Full Version : Caves via simulated lightning

11-20-2013, 05:17 AM
Using a Dielectric Breakdown Model -- essentially, simulated lightning -- produces some interesting-looking results.

They're not very fancy, but might suit a lo-fi game like a roguelike. One nice feature is that they have no disconnected parts, because of the way they're grown.


1) set the electrostatic potential along the bottom of a grid of cells to 1, and that of a "seed" cell at the top to 0;
2) calculate the potential at every other cell in the grid;
3) find all the cells which are adjacent to a seed cell;
4) choose one of these cells randomly, with probability proportional to its electrostatic potential, and let it become another seed cell with potential 0;
5) if the new cell is at the bottom of the image, or if you've added a pre-determined maximum number of new cells, stop; otherwise, goto 2.

The collection of seed cells grows downward from the original seed cell, sending out random tendrils along the way, until it reaches the bottom, or you run out of cells to place. A parameter in the probability calculation changes the shape, making the pattern straighter or more radial (the probability that a cell in (3) becomes a seed is the nth power of its potential, divided by the sum of the nth powers of all their potentials -- if n = 1, you get normal-looking lightning, if n = 0.5 it's rounder, if n = 1.5 it's straighter). The potential can be found via a "relaxation" method for solving Laplace's equation.

I just realized how mathy this has gotten, and now I doubt anyone would ever use this method, but if you're interested you can google some relevant terms and find more information. For everyone else, it's picture time!

Actually, now I'm thinking this is just utterly stupid, but after spending all this time making this post, I can't bring myself to cancel it.


11-20-2013, 06:21 AM
Center-to-edges, instead of top-to-bottom.

11-20-2013, 08:23 AM
The center to edge ones seem better for top down representation of a cave system while the edge to center ones seem better for vertical sectioning, looks a lot like what I'd expect water to do to porous weak rock.

11-24-2013, 07:23 AM
Even if they are a bit lo-fi, you could easily use these as a jumping off point. It could serve to give you some great inspiration and general backbone/shape to your cave complex.