Giter Site home page Giter Site logo

tqualizer / retro-street-fighter-reinforcement-learning Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 0.0 2.72 MB

Experiments with multiple reinforcement ML algorithms to learn how to beat Street Fighter II

Python 100.00%
retro openai-gym reinforcement-learning agent-based street-fighter ppo2 stable-baselines arcade-learning-environment

retro-street-fighter-reinforcement-learning's Introduction

OpenAIStreetFighter

Custom implementation of Open AI Gym Retro for training a Street Fighter 2 AI via reinforcement learning.

The first commit uses largely unchanged model examples from https://github.com/openai/retro as a POC to train the AI using the 'Brute' method.

  • UPDATE 21/02/21 -'Brute' example includes live tracking graph of learning rate. ppo2 implementation is work in progress.
  • UPDATE 28/02/21 - 'PPO2' model has been integrated and testing. Mlp is much faster to train than Cnn and has similar results. Additional tracking tools for training added. So far I cannot get PPO2 to comfortably outperform brute. Task added to experiment further with hyperparameters.

This repo includes some example .bk2 files in the folder for those interested to play back and observe the AI in action. I have uploaded the 'SFII610543' output from the training outputs folder from the Brute method as an example.

(Planned) additions & changes

  • Implement and test other algorithms
  • Implement discretization so that special moves are part of the moveset
  • Track learning in game
  • NEW: Experiment with different Hyperparameters
  • Apply pre-trained models to new situations (experiment with different states and characters)
  • Add ability to train from human input parameters or play against human opponent

Instructions:

  • Install the 'retro' and 'gym' packages to Python.
  • Add the custom scenario json file included in this repo to your retro/data/stable folder which has the roms in.
  • Update any parameters in the 'brute.py' example.
  • Run (note you will need a valid copy of the rom (Street Fighter 2 Champion Edition (USA) for this to work) - the training will output a .bk2 with the button inputs used each time there is a significant innovation. The algorithm will stop once the timestep limit is reached.

To render the outputs in mp4 format

In CMD cd into your directory which has the .bk2 files run py -m retro.scripts.playback_movie NAMEOFYOURFILE.bk2

retro-street-fighter-reinforcement-learning's People

Contributors

tqualizer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.