Creating Neural Networks for games

Artificial Intelligence is an important component for modern games. A particularly powerful concept in AI is machine learning, and Neural Networks are one method of many machine learning techniques.

The project I created in order to demonstrate a neural network within a game is L-Robot. You can see a video I created that demonstrates L-Robot below:

How does it work?

Neural networks are a technique generally used for pattern recognition. A large neural network can compute huge amounts of data and are proficient in finding solutions for problems such as character recognition, image recognition or even stock market predictions. But how can we use neural networks in games?

The neural network implemented into L-Robot is his brain, which controls how L-Robot moves. The network takes in two inputs and processes these inputs through a number of layers of neurons to produce an output.

The inputs for the network are:

  • The current fitness
  • The position of L-Robot relative to the closest platform

These numbers are processed to output these values:

  • A number to determine whether L-Robot should move left or right
  • A number to determine whether L-Robot should jump

The network is processed every frame and will run for 150 frames. If a solution is not found within this time, then a genetic algorithm is used to evolve the network.

Genetic Algorithm

The genetic algorithm within the project is used to evolve the weights of the neural network. A generation of thirty genes is created at the start of the program, each gene representing a different brain. After a generation has completed its run through the game, the genetic algorithm is executed.

The genetic algorithm uses roulette-wheel selection to create a new population of genes. Roulette-wheel selection consists of creating a mating pool of copies of each gene. The number of copies of each gene correlate directly to the fitness value of the gene – i.e. if a gene has 60% fitness, then 60 copies are pushed onto the mating pool – this promotes elitism, meaning the next population has a good chance of being more successful than the previous.

After a mating pool is created, random genes are selected to crossbreed a new child gene. These new children are then used to create a new population of genes to be given to the neural network. This is how the neural network is adapted and how L-Robot learns.

If you would like more information, leave a comment or email me at:

Augmented Reality for the PlayStation Vita

For a module in my 4th year of university, one of my assignments involved creating an application that makes use of a technology and attempt to innovate.

The technology I chose to base my application around was augmented reality. Using the PlayStation Vita development kits that the university provides, I created a prototype for a multiplayer cat-and-mouse game.

The game makes use of the PS vita camera and the Sony marker tracking framework. The markers are used as reference points to simulate the 3D game in the real world.

Below is a short gif of the prototype:


The objective of the game is to either achieve 30 points by standing on your house, or to bait the cat into chasing and catching the other player.