# Cilium - An artificial life simulator

Here is something that I've been working on for the past two weeks, it's in its early stages, although I've done a lot of work.

Fair warning: this is really CPU intensive and will crush anything short of an i7. Do not open it with a handheld!

http://cilium.codebuffalo.com/

Please check it out and tell me what you think, and if you can help me with the liquid simulation (pressure/drag equations), I would love to hear from you. The fluid mechanics are half-working right now. I have an implementation of the Navier-Stokes equations (particularly a Stam solver) in place; but my own rigid-body physics integration with Chipmunk is terrible.

If you come across any organisms that exploit bugs in physics, please post the genomes.

Here is a screenshot of a simulation in progress and the new brain viewer that I've just implemented (WIP):

https://dl.dropboxusercontent.com/u/27714141/cilium5.png [Broken]

Last edited by a moderator:
Medicol

Related Programming and Computer Science News on Phys.org
Fantastic project! Keep us updated on developments!

Thanks.

Here's an excerpt I posted elsewhere that will help everyone understand what's going on:

The organisms you see are swimming in fluid (the red/green/yellow hues represent fluid velocity around them), all organisms are controlled via spiking artificial neural networks. All body parts (logical and physical) have underlying neurons.

Here is a list of the currently enabled body parts:
* Flagella: motorised appendages and contact sensors. Organisms sense through and control each segment independently. (Segments turn red on contact)
* Cilia: pressure and contact sensors. Can sense current liquid pressure, with some work an organism could use them to sense vibrations. (Normally a teal circle that turns yellow on contact)
* Nematocysts: projectile launchers, can launch green projectiles that damage health. (Red circles, bugged at the moment)

Logical parts:
* Neuron: a spiking model, and that means that they can fire at will. Basic neurons have 1 channel, other body parts can have multiple.
* Controller: provides the organism with statistics/identity stuff (energy health, velocity, heading, etc) and causes the organism to reproduce when excited (provided enough energy is present).

All organisms start with 1000 energy minus a cost per body part, and they can replenish it by touching dead organisms that have surplus energy.

Superposed_Cat and Medicol
I think I finally got fluid drag right!

Superposed_Cat and Greg Bernhardt
That's an awesome simulation.Their hairs look still kind of stiff. Would you mind telling us what people may learn from you project's simulation model ?
If you come across any organisms that exploit bugs in physics, please post the genomes.
OK here is a firebug's
http://www.genomesize.com/result_species.php?id=3965

That's an awesome simulation.Their hairs look still kind of stiff. Would you mind telling us what people may learn from you project's simulation model ?
Thank you. They look stiff because they're represented by segmented chains of straight lines in the physics engine. It can be made more smooth by decreasing the length and increasing the segmentation.

What people may learn is, in the end, up to them; but the basics of evolution, how neural networks work, and emergent behaviour are some of the highlights.

Well, that certainly would cause a bug in the simulation. :D

Lizabella

This version includes many, many fixes and optimisations! I also separated synapses into two categories: logical and mechanical. Logical synapses connect neurons to neurons, while mechanical ones are used as inputs for physical parts.

This allows physical parts to freely act as regular neurons while still maintaining their inputs from the underlying neural network.

Another piece of work is the stack machine. Now every organism has a small stack machine operating in the background. It can adjust the neural network, alter weights, create and delete synapses, and control reproduction. What this means is that organisms can now evolve to learn. I plan to make it so that the stack machine can create and delete body parts to facilitate developmental encoding (growth).

Now I need to work on the PHP side and add the genome exchange functionality. This will essentially connect all running simulations to a central database. The users will be able to exchange the most successful genomes. I'm really excited at the prospect.

Organisms can now read and modify their own genome, and it will carry on to their offspring. I reduced the default mutation rate as a result.

Here's an example, the organism's stack machine was overwriting (or inserting into) the genome at offset 0.

Code:
GCAGCAGCAGCAGCAGCAGCAGCAGCACCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCA
GCAGCAGCAGCACTAGCAGCAGCAGCAGCAGCAUUTGCAGCAGCAGCAGCAGCAAGTGCAGCAGCAGCAGCA
GCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGGGGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCA
GCAGCAGCAGCAGCAGCAGCAGCAGCACCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCA
UCUGCAGCAAUTGCAGCAGCAGCAGCAAGGGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCAGCA
GCAGCAGCAGCAGCAGCAGCAGCAUCCGCAAGCGCAGCAGGTGCAGCAGCACAAGCAGCAGCAGCAGCAGCA
AUCGCAGCAGCGGCAGCAGCAGCAGCAGCAGCAGCAGCACAUGCAGCAGCAGCAGCAGCAUTCGCAGCAGCA
GCATGUCGGGGCGGCTATTGTGGCAUUAUAGTUACTACTCCGAUUGGCTGTACTGGCTGTACTTTACTGTGT
GGCGTAAUUAUUATACCGGGCTCGTGTGGCAUUACTTGTGUUACTTGACCGTGTCCGTGTGGCACTAUUUGT
CCGAUUGGCTGTGGCTGTATCTGTCUAAAAAUUACUGGCCCGACTCCGAGCTGTAUUAUUGGCACTACTAUU
ACTACTGATAGAACTCUCGGCCCGTGTGGCUUAGGCACTGGCGGCAUUGACACTUACTGTACTCGCAUUAUU
Full genome: http://pastebin.com/icYYLZKu

What this means:

1. Genetic memory.
2. Polymorphism.
3. An organism could in theory create an entirely different organism.. viruses? Maybe when I add more body variation and injectosomes.

Also, here's an interesting video of the fluid solver in action:

https://dl.dropboxusercontent.com/u/27714141/cilium8.webm [Broken]
https://dl.dropboxusercontent.com/u/27714141/cilium8.webm [Broken]

(I wish I could embed WebM directly here)

Last edited by a moderator:
thankz and Greg Bernhardt
What are the length scales of your project? I can help you with the equations. If the Reynolds number is order 1, you can approximate drag using the "stokes drag" equation. Its pretty easy to program. If your on the micrometer scale, you may need to take into account the saffman lift force. This is actually pretty complicated to understand conceptually and in more than 1 dimension is not as easy to program. If you're on the nanometer scale then you cannot neglect Brownian motion. You can use a Monte Carlo method to approximate its effects for a spherical object.

A good read for you might be "life at low Reynolds number". Its a good paper in conversational format on the physics of flows at the bacterium scale.

You could also solve the 2D navier stokes (simplified to neglect the advection terms) equations, but honestly unless your project is for CFD you will take up too much memory and time properly meshing your domain.

What are the length scales of your project? I can help you with the equations. If the Reynolds number is order 1, you can approximate drag using the "stokes drag" equation. Its pretty easy to program. If your on the micrometer scale, you may need to take into account the saffman lift force. This is actually pretty complicated to understand conceptually and in more than 1 dimension is not as easy to program. If you're on the nanometer scale then you cannot neglect Brownian motion. You can use a Monte Carlo method to approximate its effects for a spherical object.
A good read for you might be "life at low Reynolds number". Its a good paper in conversational format on the physics of flows at the bacterium scale.
You could also solve the 2D navier stokes (simplified to neglect the advection terms) equations, but honestly unless your project is for CFD you will take up too much memory and time properly meshing your domain.
All units are arbitrary at this point. I use Chipmunk2D for physics and a stokes solver for fluid dynamics and a bit of glue I wrote myself in-between to approximate drag.

The navier-stokes implementation is a bit slow, so the resolution for the solver can't exceed 64 (or 10x7.5 pixels per fluid cell). It's a Stam solver modified to include vorticity confinement. My only issue is approximating the right viscosity and diffusion values (parameters for the solver) right now.

I'd like to add Brownian motion. The problem is with flagella and the such, which can't be approximated the way you describe.

I've read 'life at low reynolds number', it's quite good. Although some of the equations fly straight through my head. :)

If your resolution is that low then NS might not even work. Check your knudsen number. Usually continuum models cannot be applied when Brownian motion is not negligible. So you might want to take a look at diffusion models that don't use or limit continuum approximation.

Again, your length scales have to be O(10^-9) for these considerations to be valid.