This is a relatively simple simulation of multiple species fighting for survival.
A terrain is generated using Perlin noise. The noise values are blurred to smooth out the edges a little.
Multiple types of creatures are created that inhabit the world. They each have properties like;
X and Y position – where the creature is in the world
Radius – how large the creature is
Direction – what direction the creature is facing
Speed – how far the creature moves each step of the simulation
Color – what color it is so creature types can easily be distinguished from one another
Sides – creatures are shown as polygons with between 3 and 8 sides
Age – how many simulation steps has the creature lived for
Maximum Age – if a creature reaches this age it dies of old age
Minimum and Maximum Breed Ages – a range of ages that the creature can reproduce
The simulation is started by creating a bunch of random creatures in the world. They all move according to their properties.
When 2 creatures come into contact with each other they fight for survival. At this stage I have 3 possible fight methods to determine which creature wins;
1. Random – one of the creatures in the fight is randomly chosen to die
2. Attacker wins – whichever creature first moves and hits another creature kills the creature it hits
3. Strongest wins – Creature strength goes up from birth to middle age then down again as the creature ages. This is so “babies” and “elderly” creatures are not as strong in battle against middle age creatures.
Creatures have a chance to duplicate themselves if they are between a minimum and maximum breed age and if there is room near them for the child creature to be born into. There is an option for the child properties to be mutated slightly (or not so slightly).
Here is a sample movie showing a full run that lasts until one of the species manages to kill all others. No mutations in this example.
Species is now available as a mode within Visions of Chaos.