Project Overview

Wispy Lineage is an artificial life simulation based loosely on the biological process of mitosis.

This project uses the Artificial Life Javascript library created by Professor Graham Wakefield, which can be found here. The local version running the preview below can be found here.

The source code can be found here, or by looking at the code running the preview below.

Below is an embedded preview of the project output. The project will output something different every time, so if you want to test it out a few times, right click on the dark grey part of the frame below and select “Reload frame,” or simply refresh this page.


The idea

I really like the idea of a system of agents starting from a single point and evolving to create an interesting ecosystem of agents. This piece is loosely based on the process of mitosis, in which a cell divides to form two identical cells. In this piece, when a cell splits, the new cells each inherit the colour of their “parent” cell, but with a slight variation. The first agent’s colour is chosen randomly, but it had to be within a certain range, otherwise there would be very dark agents who weren’t visible against the background. Agents then either split into two, die, or grow bigger.

Technical details

The “evolution” of the system was the hardest mechanic to tackle, because there was a lot of balancing to be done, in order to avoid uninteresting or unappealing visuals. A few things that I had to figure out were: when to split the agents, how much to vary the colour of the new agents, how to avoid making it become visually uninteresting, how the agents should interact with one another, and how the agents should move through the space.

In order to have agents split in an interesting way, I chose to give each agent a “lifespan” – a random number within a certain range (up to 15 seconds) —and when the agent reached that age, it would split into two identical agents with slight variations in colour.

Certain attributes of each agent are determined by their red, green, and blue colour values. The red colour value is used to change how the agent walks through the space, the green colour value is used to change how far around itself each agent can see, and the blue colour value is used to change the strength of the trail left behind each agent.

The initial “filling” of the world doesn’t take very long, and the world is quickly filled by a large number of agents. It’s interesting to pay attention to how closely the overall colours resemble the initial agent’s colour. I found that the first few mutations of the colour have the largest impact on which colours end up filling the space.

Initially, I had the agents avoiding each other and flocking together, but it threw the other mechanics in the system too far out of whack, so I made the agents move around randomly instead. This also had the added benefit of a more interesting background. When an agent hasn’t seen another agent in a long time, it either dies or it grows bigger.

After a long enough period of time, the system more or less stabilizes to create an interesting wispy collage of moving colours. Some agents still grow in size, but all splitting and growing of agents is locked after the maximum population size is reached in order to avoid performance issues, so in order for new actions to happen, existing agents have to die off. This results in mutations slowing down significantly once the population limit is reached.

One way that I decided to keep the space visually interesting was to make agents get bigger again. It was tricky because it had to be done in such a way that the space wouldn’t just be completely filled with a ton of tiny agents 100 percent of the time. I ended up making it so that every time an agent would split, it has a chance to grow to 3 times its current size. This chance is determined by how close the current number of agents is to the maximum population size. The closer the population size is to the maximum, the more likely it is for agents to grow in size.