Dinobot v2

Teo, 09 June 2020

How do we make dinobot better?

The overview of the plan is to use a neuroevolution algorithm NN to play the game instead of the bootleg algorithm I came up with that cannot be generalized that well over all states of the game. At first I was going to still keep the browser automation part and use my new algorithm to play the game in browser (and altho I might still do this in the future), for now I decided against it. Instead, I'm going to recreate a copy of the game in Java in order to learn more really. I have never created a game from scratch, so I thought this to be a good opportunity to do do. I have a dcent amount of experiences with DNNs, but only in Python so I'm excited to test my knowledge by applying libraryless. So without further ado, let's see the plan broken down into more digestible pieces!

Creating the game

Note: this is just a theoretical plan, the final project might end up being a little different.

There aren't many objects in the game so this simplifies things. I will have 2 main classes: one for the dinosaur itself and one for the obstacles. The dino class shall include the following variables: coordinates within a cartesian plane, size (width and heights), score etc. Now for the more phsysicsy part, I will need a container for velocity and gravity and jumping force. To determine weather the dino is dead or not, a boolean value isDead will be included. Now for the methods: the dino will be able to jump, duck, stand up and the score will update based on distance.

Now for the obstacles. There are two types: birds and cactuses. Each will have their own class that extends the main Obstacle.java class. Here we need to store the obstacle coordinates in the cartesian plane, size and movement speed (only for birdies). A method will check for collisions with the dino.

Neural Network Arhitecture

There will be 2 NNs one ofr each type of obstacle. The cactus NN inputs are the following: distance to obstacle, size of obstacle (width, height), dino's position on the oY axis and velocity. The bird NN will include all the following plus the position of the bids on the y axis and thier velocity. The outputs are: jump, duck, do nothing.

Genetic Algorithm