Cell World: Cell and Plants Animation

The first stages of building the app creates an animation framework, with objects that represent plants and cells. Refer to the Cell World Home Page for downloads and an overview of the project.

Stage 1: First Cells

To get the project off the ground I have chosen to use an image area of 1000 x 1000 pixels in size. There are 1000 cells moving in a random direction, with a random colour. Each cell is drawn as a filled disk and the cell wall is drawn using the same colour. Because the cell is translucent, the overlap between the cell wall and its filled disk is brighter.

In the future, there will be multiple layers but for now, there is just one layer. That layer is double buffered, meaning that there are two images used to make the animated image work. One is used to show the current image frame while the next image frame in the sequence is drawn on the hidden image. When the time comes, the two images are swapped around and the next frame is started.

Before the cells are drawn, they are all updated so that its position can be altered. The cells are constrained to the image area. When the cell exits the tile on one side it is re-positioned on the opposite side. From the cell’s point of view, it is travelling forward on an infinite plane.

This is the final result of the first step. The critters are anti-aliased for a nicer finish. Its important that this be attractive to look at too.

Stage 2: First Plants

Cell World early attempts at plant generation with cells acting independently on another layer
The earlier plant evolution rules created regular grids

Having considered the development arc already, I had already decided that the app would need to contain layers. This is the first layer to be added to the program, in the form of a plant-like material that will provide energy to the cells.

Earliest attempts based on a variation of Conway’s ‘Game of Life’ didn’t work as desired, tending to produce regular rows and columns of various types. This was because the plants exist over a period of time, rather than frame by frame and this changes the behaviour.

When the population is close to zero, the landscape is seeded with new plants that grow into unpopulated sites on a grid. This video is speeded up to see the effect, but in the game world will be quite a slow progression.