This project had 2 purposes: to learn about procedural content generation and how to apply design patterns into games. We decided to give ourselves an extra challenge by trying to combine 2 courses into 1 project. The goal was to create robots that could “learn” how to navigate a static obstacle course through genetic algorithms.

Each robot always has 5 thrusters available. Each thruster can move the robot in another direction based on these attributes:

  • Initial delay before it activates
  • How long it will be active for
  • An interval before activating again
  • The power of the thruster
  • At which angle to propel the robot

Initially these attributes will be completely random, but through evolution via the genetic algorithm, the robots will “learn” which thrusters to use in order to reach the target. Every robot will then get a score based on the following questions:

  • Did I reach the target?
  • How close did I get to the target if I didn’t reach it?
  • Did I fly into a big meteor?
  • How many small meteors did I fly into?
  • How fast did I reach the target?

As mentioned before, we also used this project for learning about design patterns. We implemented the following 7 gang of four design patterns:

  • Singleton (to restrict only 1 ThrusterBuilder)
  • Builder (to build the actual thrusters)
  • Prototype (to clone a robot)
  • Object Pool (to reuse robots after each generation)
  • Private Class Data (to keep the state private)
  • Template Method (to create an abstract and reusable genetic algorithm base class)
  • Memento (to save and load robot data between generations)

Most things were pair programmed, but my biggest contributions were on the general implementation of genetic algorithms, the fitness score and the UML design to combine all design patterns.

The demo can be found here. A new generation is made every 15 seconds.

  • Language used Unity C#
  • Team size 3
  • Made for course on Automated Game Design
  • Made for course on Game Design Patterns for Games