In this tensorflow js project, AI learns to play Gorillas game using supervised machine learning algorithms.
If you want to watch how I did this project, here is the video:
https://youtu.be/ySANlOrdsQE
To predict the outputs, this AI bot uses a simple neural network with 3 inputs, 16 hidden nodes and 2 outputs.
The network is trained by applying polynomial regression to a bunch of data, previously collected by the brute-force method.
The project is consisted of 2 parts:
- implementing original game
- implementing AI Bot using supervised machine learning
The prototypes of both parts are stored in this repository.
The game is programmed in Javascript using Phaser 2 framework and TensorFlow.js library.
Here you can run the AI Bot game and read the complete tutorial:
https://www.askforgametask.com/tutorial/machine-learning/gorillas-ai-bot/
If you just want to play original Gorrilas game with your friend, go here:
https://www.askforgametask.com/game/gorillas/
Official website:
https://www.askforgametask.com
The game prototype is stored in the \01_game folder.
It has the following subfolders:
- \assets - contains all the assets
- \libs - contains all the needed libraries
- \scripts - contains the source code files
The AI Bot prototype is stored in the \02_ai_bot folder.
It has the following subfolders:
- \assets - contains all the assets
- \data - contains the training dataset with 100,000 data records
- \libs - contains all the needed libraries
- \model - contains a pre-trained neural network model
- \scripts - contains the source code files
To run javascript apps locally, you need a local web server.
So, here are the instructions how to set up this project to run it on XAMPP web server (if you already have some server installed on your computer then skip to the step 3):
- install XAMPP on your computer (for instance in C:\Xampp folder)
- configure and run the server (read the server's manual or help if you don't know how to do that)
- navigate to the server document root: C:\Xampp\htdocs
- create a new folder called 'gorillas': C:\Xampp\htdocs\gorillas
- download the project
- copy all project files directly in C:\Xampp\htdocs\gorillas
- now you should have the following folder structure:
- C:\Xampp\htdocs\gorillas
- \01_game
- \assets
- \libs
- \scripts
- \02_ai_bot
- \assets
- \data
- \libs
- \model
- \scripts
- \01_game
- to run the game, open a web browser and navigate to
http://localhost:<port>/gorillas/01_game/scripts - to run AI Bot simulation, open a web browser and navigate to
http://localhost:<port>/gorillas/02_ai_bot/scripts