Genetic Algorithms and Debugging

This is my first time participating in on of these competitions, and I’m greatly enjoying it so far.  I figured I’d write a blog post to summarize the first day here.

My game has you fight waves of randomly-generated enemy “bots”.  When I say randomly-generated, I mean whole-hog random.  Colors, behaviors, weapons, stats – it can all change.  After the first set of enemies, I start using a genetic algorithm to combine these enemies, hopefully ramping up the difficulty and making some neat combinations.

Genetic algorithms are really cool and they suck at the same time.  On the positive side, it’ll be easy to balance the game when the algorithm works right – if it keeps picking certain features over and over, I’ll nerf ’em.  On the downside, it’s hard to tell if things aren’t working quite right.  I played a few generations and noticed that the game kept dropping weapons for some reason.  It would select out almost all weapons by the fourth generation.  I was pretty sure this was not, in fact, the optimal solution to the problem.  Turned out to be some misplaced curly braces (sheesh).

So what’s still to do?  Sound and music, notably. A pause menu. I also think it would be pretty cool to have a system for exporting enemy genomes having friends fight them, or even having two bots fight each other.

Here’s a screenshot!
Screenshot

Comments

t-recx
26. Aug 2012 · 08:06 UTC
That’s looking pretty cool!
BMacIntosh
26. Aug 2012 · 15:17 UTC
Hey, thanks :). The genome has two parts. The first has a number of “feature” genes, which include things like weapons and stat boosts. Each of these genes can have a number of different values, which are subject to mutation individually. Each genome contains a random assortment of these (10 is the usual number). The second part has 5 “mandatory” genes, which include color and 4 parameters that control how the AI decides to move (aggressiveness, etc). Each genome contains exactly one of each of these.