Posts Tagged ‘Genetic Algorithms’

(Very Basic) Genetic Algorithm

Posted by
Saturday, 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 !


Space Evolvers – Done!

Posted by (twitter: @netfighters)
Sunday, August 26th, 2012 3:35 pm

Just submitted my entry!

It was really fun to integrate genetic algorithms, neural networks and games, pretty much everything I love 😀 Also, I could experiment with the Crafty JS/HTML5 engine and concluded that it has a lot of potential, but it’s really in an early development stage yet, with some bugs and strange design decisions. Besides that, JS/HTML5 still sux a lot… I thought that by now it would be pretty standarized within all browsers, but actually there is still a lot of hacks needed to make something crossbrowser.

Reasonable Progress

Posted by (twitter: @netfighters)
Saturday, August 25th, 2012 4:11 pm

My game is already half-playable here:
It’s still not possible to die and there is no hud, powerups or different weapons, which I plan to add tomorrow. But it’s already possible to kill the enemies and see their behavior evolve! To achieve this, I’ve used a simplified genetic algorithm combined with a single layer neural network.

And since I didn’t post my setup before the competition start due to some strange word press bug, here it goes:
Language: HTML5/JS
Engines/Libs: Crafty + Sylvester
Editor: Gedit
Audio: Bfxr + Audacity + Wolfram Tones + Timidity
Graphics: Gimp + Inkscape

[cache: storing page]