Enemy DNA

Here’s what I’m working on: a Space Invaders clone with evolving enemies. The idea is that the last few enemies to survive will be cross-bred to grow the new generation for the next level. Hopefully this will lead to a sequence of ever-varying levels of increasing difficulty, without me having to do anything!

I currently have a swarm of freely moving enemies, each with a set of parameters (floating-point values in the range  0-1), which I call their DNA. I also have bombs, bullets and collision detection.

Their appearance is based upon the very same DNA string, so we get a nice variety of enemies:

Infinite variety in infinite combinations

If things go according to plan, we might start to see some convergence in colours and faces after a few rounds.

Current behaviour is still limited to “move in a straight line and drop bombs at random moments”, but the next step will be to do something interesting based on the location of nearby bullets, the player and other enemies, all parametrized by their DNA. I’ll make enemies die if they collide with each other, and add some rules that result in “safety in numbers”, so I might get some interesting swarming behaviour out of that.

As it’s an HTML5 game, I’m planning to store the DNA of the entire population inside the URL fragment, so you can bookmark certain levels and try out different branches of evolution.

Comments

mfitzp
25. Aug 2012 · 10:47 UTC
Lovely idea and like the aesthetic. You’ll probably want to look at adding some element of randomness (mutation) and cross-over (wholesale swapping of ‘chunks’ of DNA) to keep things variable and interesting. Otherwise you’ll very quickly find yourself with all the enemies identical.
26. Aug 2012 · 12:26 UTC
Thanks for the ideas, mfitzp!