Game Development Reference
In-Depth Information
Flowing water with cellular automata
Cellular automata is an n-dimensional set of cells that interact together with a given set of
rules. Over time, these interactions have given way to patterns, and modifying the rules
will modify the pattern. The most famous example is probably Conway's Game of Life
where cells based on an extremely simple rule set create the most amazing, evolving pat-
terns. In games, cellular automata is usually found simulating liquids in a tile- or
block-based game worlds.
In this recipe, we'll explore such a liquid system based on a 2D grid. Since it's 2D, there
can be no true waterfalls, but it can still be applied to a heightmap (which we'll show) to
create natural-looking rivers.
Performance becomes an issue with large cellular automata, which will become evident as
they're scaled up. To counter this, we'll also look at a couple of different techniques to keep
the resource consumption down. The following image shows water running down the slope
of a mountain:
Search WWH ::




Custom Search