Simulation – eat/mate/die

I created a basic “eat/mate/die” simulation in Processing. Creatures wander around the screen looking for food. When they are no longer hungry they begin a mating dance by slowly circling the center of the screen. If they are able to crash into each with sufficient velocity they will mate and reproduce. Eventually the creatures die of old age, or starvation, and become food for the surviving creatures to eat.

[vimeo w=640]

The movement of the creatures is governed by steering behaviors that I picked up while reading The Nature of Code. Each creatures is pushed and pulled by four internal forces:

  • Hunger pushes creatures toward food.
  • Mating pushes creatures into a circular pattern and is inversely proportional to the hunger force.
  • Separation pushes creature away from each other to prevent overlapping. Separation can be overcome by a strong mating force.
  • Wander pushes creatures to explore the world.

Each creature has a unique name, selected randomly from the Social Security Administration’s list of top 1000 baby names from 1880.

The user is able to zoom in on and follow individual creatures with the space bar. While following a critter you can zoom further in or out using the mouse wheel, select other creatures to follow with j or k, and gently steer using the arrow keys. i reveals all the creature names and statuses, and pauses or resumes the animation.

You can play with it here:

And download the code here:

2 thoughts on “Simulation – eat/mate/die

  1. Project Ideas – Sam Lavigne

  2. A Simulation of Something – Sam Lavigne

Leave a Reply

Your email address will not be published. Required fields are marked *