I’m trying to get a “player”/circle to avoid getting hit by “obstacles”/other circles, based on Daniel Shiffman’s Neuroevolution Flappy Bird/with tensorflow.js. (https://youtu.be/c6y21FkaUqw)
The algorithm has the following inputs:
- The player’s own velocity and radius
- The 3 toroidally nearest obstacles’ position (relative to the player), velocity and radius
- The width and height of the screen
- A bias of 1.0
The algorithm has the following outputs:
- Should and how far should it move left?
- Should and how far should it move right?
- Should and how far should it move up?
- Should and how far should it move down?
I am currently training it with ~13 hidden nodes with one hidden layer (I’ve attempted adding a layer and that did not work within my tests)
I’ve experimented with
- Different obstacle amounts and velocities,
- Different player amounts,
- My own GA and the GA in Dan’s videos,
- Made sure the near obstacles’ relative positions were actually being calculated correctly
- etc.
Despite all of this, I’ve tried training this for upwards of 1600 iterations and it made no measurable progress. I’m sure I’m missing something very simple, but I just can’t figure it out. Could it be something with the genetic algorithm, the network structure, or just that I haven’t trained it long enough, or something else?
If you would like to help, the relevant files in the p5.js project are most likely “AIPlayer.js” and “ga.js”, since most everything else besides settings is more of backbone for the environment.
I tried my best to comment the code thoroughly. Thank you in advance for helping, and please let me know if I’m being too vague with my question.
The project is at p5.js Web Editor