Monday, 28 June 2010

Physics Evolution: Step 1

After a bit of a post exam break I'm back to my desk and playing around with some projects that I've had to let lie for some reason or another over the last few months. The first one I thought I'd look at again was the Creature Evolution in Flash article I wrote a few months ago. Back then the idea was to write a program that would evolve creatures using genetic algorithms. Today I've been working on the first step namely creating a world within which these creatures should be able to evolve. This requires a physics engine and instead of writing my own from scratch, or using something I've made before I decided to go with an efficient, fast, and reliable engine, APE, by Alec Cove. You can download the API here.

So I've been getting to grips with the engine which seems fairly simple to use and here is a little demo:

So what is next? The idea behind genetic algorithms is that some genotype, in this case a string of 1's and 0's, determines a phenotype, in this case the structure of a creature. By randomly mutating bits in the genetic code, and testing the resulting creatures against one another, and sticking with the code that yields the best results, creatures can be made to evolve. Creatures can for example be tested for their ability to run fast, or for their ability to jump, or to swim.

Ideally I will reach a stage where code can be saved at any stage of the process, and can be emailed to another person somewhere else in the world who can continue to evolve the same creature. Obviously since evolution is random there could be some very interesting splits. It would be nice to create a sandpit where creatures could be watched. A further investigation would be the effect of mating genotypes to create hybrid creatures, and obviously the nature of the algorithm used to produce creature structure would determine the success of this.

Anyway stay tuned for progress!

No comments:

Post a Comment