In
Gamasutra's latest feature, writer and developer John Harris discusses cellular automation, a technique for simulation currently found in such indie hits as
Minecraft and
Dwarf Fortress.
What is cellular automation?
"It allows water to flow, gases to spread, boulders to fall, and other systems propagate and change over time. To perform these feats, it runs a complex system that, each frame, decides on the contents of each cell of a grid-based game world," writes Harris, who is currently using the technique in the development of his own game,
In Profundis.
"While cellular automation must be designed with an eye towards minimizing processor time, it is not necessarily the case that it runs slowly.
In Profundis' is fairly complex at it stands, and can handle large amounts of flowing liquid and spreading gas while still maintaining frame rates upwards of 45fps," Harris writes, before going into detail on how his game specifically handles the simulation.
You can watch a video of
In Profundis' cellular automation for water by
clicking here.
"The takeaway point here is that I covered all the relevant possible situations that a cell containing water could exist in, and just coded what should happen for each one. I didn't worry about what water should do as a body; I just focused on simulating a little bit of it, and iterated that through the whole screen in a loop," Harris explains.
The full feature is
live now on Gamasutra, and goes into great depth on the ins and outs of the system.