Neural network trained evolutionarily to play a game.
Made with Java and Processing.
This is a demo of the AI playing one game.
- Clone repository
- Run
./gradlew build && ./gradlew run - You will see the AI play a random game. Press
spaceto restart a new game once a game ends.
- Open
src/main/java/gameai - In the first line of main, there should be a string
option - Set that to
playto play the game as a person, or totrainto train- To play, use left, right, and down arrow keys
- In training, press
spaceto view the next generation play, and thenspaceagain to go back to silent training
- Move left, right
- Stomp opponenets
- Death if touches opponents
- Score increases every second and stomping opponents
- Stomping increases by a "streak" mechanic: more stomps without touching ground = higher score
- Stomping without hitting opponents loses a few points
- Recurrent Neural Network
- Fully implemented in pure Java all the way down because I couldn't find any well-documented matrix libraries
- Two hidden layers (sizes of 64 & 16)
- Recurrent layer of size 10
- Input:
- Closest 6 enemies: x, y, m speed
- Player: x, y, m speed, isStomping
- Output:
- Left, right, down
