About Me

Projects

Shear
(C++/Lua/DirectX/OpenGL)

VisualWoWSim
(C++/Lua/XML/DirectX/OpenGL)

Flash Games
(Flash/ActionScript3)

Cellular Automata
(C++/Lua)

Mittens Massacre
(C#/XNA)

Contact

[email protected]

Cellular Automata

Status

Complete

Description

Cellular Automata is a small program I wrote that simulates various physical properties using a grid of cells.

Technical Features

  • All of the automata logic is written completely in Lua
  • Lua optimization tricks were used to give better performance
  • C++ provides the bindings to loading, running, and drawing
  • The Win32 console window is double-buffered to provide smooth redraws
  • The automata logic was inspired by and based off of Tom Forsyth's excellent article on Cellular Automata for Physical Modeling

Cells A.K.A. Conway's Game of Life

The simplest use of Cellular Automata is Conway's Game of Life. The rules are simple:

  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with more than three live neighbours dies, as if by overcrowding.
  3. Any live cell with two or three live neighbours lives on to the next generation.
  4. Any dead cell with exactly three live neighbours becomes a live cell.

These simple rules can create interesting patterns and displays. Here's a short video of a few patterns.

Get the Flash Player to see this video.

FishTank

Fish tank is an advanced version of beach. It allows user interaction to place solid areas and insert water into the tank. The video explains it better than text ever could

 

Get the Flash Player to see this video.

Fire

Fire uses each cell to model temperature and heat flow in the system. For example, lighting a tree on fire with right-click will cause it to burn. As it burns the temperature in its cell increases and spreads to nearby cells. If any nearby cell has something flammable then it'll also catch fire when the temperature passes its "flash point". The tree will continue to burn until there's nothing left but ash. Some heat escapes from the system and into the 'atmosphere' each update. This video shows the process and the heat map of the system.

 

Get the Flash Player to see this video.

A* Path Finder

Cellular Automata can also be used for path finding. In this Pac-Man like demo five monsters chase you using an A* path finding algorithm. Additionally, the player is controlled using the same algorithm. Clicking and holding will cause the player to move towards that cell, but with monsters in tow!

 

Get the Flash Player to see this video.

As a World of Warcraft AddOn

All of the logic is written in Lua. C++ is only used to bind Lua to the graphics console. As such, using a wrapper file, also written in Lua, the logic can be wrapped in a way that the graphics are represented using World of Warcraft GUI widgets. Simply download the binary below, and extract it into the World of Warcraft addon folder. Launch WoW and use /ca to open the Cellular Automata window.

Get the Flash Player to see this video.

Code Sample

Click 'show source' to view a code sample from Cells.lua. This file contains all of the logic for the Conway's Game of Life script. It also shows how each simulator connects with the menu system.

Downloads