Matthew Bird - Dino Game

submited by
Style Pass
2024-11-10 08:30:04

My plan for this project was to replicate the iconic dinosaur game and train a ML model to beat it. My main goal was to use the minimal amount of libraries, meaning no ML libraries, while keeping the code relatively short and simple.

The first ML algorithm is a feed forward neural network that takes in the player’s height above ground, next obstacle’s distance, screen scroll speed, the next obstacle's width, and the next obstacle's height. After two hidden layers with 5 nodes each The player decides to jump, drop, or do nothing based on the output node with the highest value.

After each generation of 3 trials, the top 20% of models experience no changes. 79% of the remaining models are completely redone, taking 2 models from the top 20%, taking the average weights, and making slight changes to them. The last 1% is a completely randomly created model. The idea is that the top 20% of models can only get better, the 79% will eventually find better solutions and enter the top 20%, and the last 1% will eventually lead to finding the best neural network given infinite time.

My aim for the second ML algorithm was for it to be a bit more complex and hopefully be more widely applicable. This neural network is also a feed forward neural network that takes in the player’s height above ground, next obstacle’s distance, screen scroll speed, and the next obstacle upper y value, with two hidden layers of 250 nodes each, and the player deciding to jump, drop, duck, or do nothing based on the output node with the highest value.

Leave a Comment