The God Delusion

I am now over halfway through reading The Nature of Code by Daniel Shiffman in amongst learning and sketching out ideas in JBox2D, ToxicLibs and the other normal distractions such as earning money doing my day job and watching old black and white movies on the daily commute. I read the chapter on Autonomous Objects and some of Craig Reynolds’ work on flocking behaviours that was recommended by Daniel. I’d created a few sketches already where I’d tried to create some form of life so this seemed like a good point to put the books down for a while and develop some of those unfinished sketches using some of the new techniques mentioned in this chapter.

One of the exercises and projects recommended in the book is developing your own eco system. I’d created a sketch with various types of ‘creatures’ where I’d tried to develop some form of rudimentary interaction already but it was still very clunky. However, I was now able to add behaviours where you could make it appear as if creatures were learning and making decisions for themselves.  The basic concept is this: There are Plants, creatures called Boids that feed off the plants and creatures called Snakes that feed off the Boids. The animals can reproduce, detect food, flee predators and learn from each other and the Plants can reproduce and some can be poisonous causing illness in Boids.  I wanted to make them all coexist for as long as possible. However, after I’d finished the bulk of the simulation, I found myself spending an inordinate amount of time fiddling with all the parameters trying to get them ‘right’. That’s when it hit me. There were no right or wrong parameter amounts; this is where the fun part came into the simulation I had created. Increasing one parameter could greatly affect a seemingly unconnected part of the simulation and create some interesting patterns and behaviours. Chaos theory in miniature!

Using the ControlP5 library I created a GUI that allows you to change the certain parameters yourself, whether this be the initial populations of each creature or how quickly they age or reproduce.

I’m fairly satisfied with what I have created so far although I’m already thinking about how I can improve it and also make the simulation more interesting such as introducing disease, mutant genes, weather systems and other species.

The code for this project is on Github and a zip file is available below.

God_Delusion