Skip to content

Pristar4/SnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues MIT License


SnakeGame - AI Edition

Training an AI to play the classic Snake Game!
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgments

About The Project

Example training with tensorboard and mlagents

This project is about making a sophisticated AI that can play the classic Snake Game efficiently. The goal was not only to cultivate the AI's ability to survive in the game, but also to potentially maximize the score that it can achieve.

(back to top)

Built With

This section should list any major frameworks/libraries used to bootstrap your project.

  • Unity
  • DotNet.com

(back to top)

Getting Started

Due to the project being constructed in Unity, you would need to have Unity and IDE support for Unity projects installed on your machine.

Prerequisites

This is a list of things you need to use the software and how to install them.

Install the following software:

Installation

Perform the following steps to set up and run the project:

  1. Clone the repo

    git clone https://github.com/Pristar4/SnakeGame.git
    
  2. Set up the virtual environment in the mk-agents folder under SnakeGame\ml-agents by running:

    python -m venv ./venv
    
  3. Activate your virtual enviroment:

    .\venv\Scripts\activate
    
  4. Install ML-agents:

    python.exe -m pip install --upgrade pip
    
  5. Install torch:

    pip install torch -f https://download.pytorch.org/whl/torch_stable.html
    
  6. Install Tensorflow

    pip install tensorflow
    
  7. Install ml-agents-env

    pip install -e ./ml-agents-envs
    
  8. Install ml-agents

    pip install -e ./ml-agents
    
  9. install tensorboard

    pip install tensorboard
    
  10. Start the training by running:

    mlagents-learn config/ppo/Snake.yaml --run-id=trainingRun01
    
  11. start TensorBoard to monitor training:

    tensorboard --logdir results
    
  12. Enter the Play mode in the Unity editor in the AI scene under

    SnakeGame\Assets\SnakeGame\_Levels\AI

(back to top)

Usage

Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.

For more examples, please refer to the Documentation

(back to top)

Roadmap

  • Working Prototype
  • Working ML-Agents implementation
  • Refactor out of SnakeAgent as GameManger
  • Player vs AI
  • Support multiple Snakes
  • Snake BattleRoyale / Match Handler

See the open issues for a full list of proposed features (and known issues).

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

Felix Jung - [email protected]

Project Link: https://github.com/Pristar4/SnakeGame

(back to top)

Acknowledgments

(back to top)