(Very Basic) Genetic Algorithm

Posted by
December 19th, 2015 12:15 pm

I recently got very interested in this great screensaver that uses Genetic Algorithm and wondered how it works. With LD coming soon, I decided I’d learn the basics of Genetic Algorithms and try to make a game about it. Luckily, “Growing” theme was a perfect fit.

The Goal :
Make a genetic algorithm that generates creatures that can walk farther and farther.


How it works (sometimes ) :

Each creature is a combination of many different attributes that are randomized for generation zero. Here’s a few of those :

  • Amount of limbs
  • Size & position of limbs
  • Amount of motors
  • Motor’s position, links, power and maximum rotation

To mix two creatures together, a function mixes the attributes of the “father” (the player’s creature) and the “mother” (the partner’s creature) with a little randomness applied and produce a set amount of new creatures. All those creatures are then tested and evaluated based on the distance they can reach and the best one is picked as the new player’s creature.

Here’s a few examples of two parents (creature in the front row)  getting mixed and the other creatures being tested (those in the back) :

If you’ve played our game, you’ve probably noticed that the generation isn’t perfect. That is why we introduced permanent stats such as strength and endurace to make sure there’s progression even if the genetic algorithm fails.


Conclusion :
The generation is far from perfect, it even broken sometimes. However, it was a lot of fun to make and the randomness makes it very interesting sometimes. I wouldn’t have had the opportuniy to try Genetic Algorithm otherwise so I’m glad I did here.

If you’d like to try it out our game, here’s a link !


Tags: ,

One Response to “(Very Basic) Genetic Algorithm”

  1. Mantlair says:

    Dude, I will definetly check this out. Using genetic algorithm for cool stuff is one of my goals for future! *is hyped*

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]