FPS with Genetic Algorithm (OpenGL & C++) MSc Research Project

 

This video shows the first couple waves of the game I developed as part of my research project on “Evolving waves of enemies in a first person shooter” which was the final project for my MSc in Computer Game Technology. This project was created using Visual Studio and OpenGL and written in C++. In the video above, I show off the various gun types I created for the game. In particular, I had fun developing the spray patterns of the two shotguns shown above.

The aim of the project was first to create a frame rate independent game engine in C++ to run a basic first person shooter. Then I was to implement a genetic algorithm to simulate the evolution of the enemies between waves through mutation and selection based on a fitness function. This way the alien enemies would gradually evolve depending on the player’s play style. The final aim of the project was to implement the necessary AI to test this genetic algorithm and to ensure the enemy aliens did evolve differently depending on the play style and type of weapon used by the player.

For this reason, the visual representation of the game was intended as a debugging tool. Thus I apologise for the crude graphics that can be seen in the video. Cuboid shapes were the easiest way to represent most game objects, including the melee attacks of the aliens. Various visual artifacts were also not removed since they did not affect the testing of the game (including the horse that has no impact on the game). For the same reason, there is no audio with the video.

This objectives of this project were achieved. The aliens were given various traits such as size, aggressiveness factors, health, speed, damage output etc. Using the AI to extensively test the game, the results showed that the aliens changed wave after wave depending on what helped them deal more damage or survive encounters against the player. To make it interesting and more balanced, the “genes” involved affected multiple traits both positively and negatively, to avoid the genetic algorithm always maximizing the effect of the positive “genes” and minimizing the effect of the “negative” genes. The fitness function I found most suitable for the aliens took account of the damage inflicted on the player as well as the number of encounters survived against them(that is if the alien took damage and then had enough time to heal). If this were developed into a full game, the first thing I would add gameplay-wise would be the visual feedback for the various alien traits such as longer arms or claws or different coloured skin (there is no such visual feedback in this version apart from the variable size of the aliens).

Leave a comment