Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Cilium - An artificial life simulator

  1. Jan 19, 2015 #1
    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!


    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: May 7, 2017
  2. jcsd
  3. Jan 20, 2015 #2
    Fantastic project! Keep us updated on developments!
  4. Jan 20, 2015 #3

    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.
  5. Jan 26, 2015 #4
    I think I finally got fluid drag right!

  6. Jan 26, 2015 #5
    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 ?
    OK here is a firebug's
  7. Jan 26, 2015 #6
    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
  8. Feb 9, 2015 #7

    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.
  9. Feb 13, 2015 #8
    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 (Text):
    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: May 7, 2017
  10. Feb 20, 2015 #9
    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.
  11. Feb 21, 2015 #10
    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. :)
  12. Feb 21, 2015 #11
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook