Creature Evolution by Genetic Algorithms

With genetic algorithms, different goals can be obtained without having to program them by hand.

In this project, genetic algorithms was used to simulate evolution by having the user define a set of goals and watch the creatures learn to solve them by getting more and more adapted to their environment.

We were seven students working together in this project and I contributed with the following:

  • Designing the genetic algorithm governing the evolution process (partially).
  • Integrating bullet physics in the program (partially).
  • Weighting and definitions of fitness functions.
  • Defining a tree structure for creatures limbs and their connections.
  • Setting up a rendering pipeline in OpenGL.
  • GLSL shader programming.

The program is created with C++ and some external libraries and API:s.


The physics simulation of this program is done with a library called Bullet physics. It makes it possible to handle collision and movement of 3D rigid bodies and soft bodies. This program limits it to handle boxes combined with hinge constraints.

The creature, which is made up of these boxes, is put in the physics world; and then, from its behavior, it gets a fitness-value which indicates how well it solved the task it was given.

By comparing fitness-values among creatures, it is possible to make the better ones evolve through mutations; and this way, after several generations, find a creature that hopefully solves the task.


3D graphics are handled with OpenGL which, with shader programming, makes it possible to program light sources and map textures on the objects.

User interface

The graphical user interface is made with the Qt library and Qt widgets. It makes it fairly easy to handle user input with graphic components like sliders and buttons.