Code Monkey home page Code Monkey logo

stable-retro's Introduction

Stable-Retro

A fork of gym-retro ('lets you turn classic video games into Gymnasium environments for reinforcement learning') with additional games, emulators and supported plateforms. Since gym-retro is in maintenance now and doesn't accept new games, plateforms or bug fixes, you can instead submit PRs with new games or features here in stable-retro.

Currently added games on top of gym-retro:

  • Super Mario Bros 2 Japan (Lost Levels) - NES
  • Hang On - SMS
  • Punch Out - NES
  • WWF Wrestlemania the Arcade Game - Genesis
  • NHL 94 - Genesis
  • NHL 94 (1 on 1 rom hack) - Genesis
  • Super Hang On - Genesis
  • Tetris - GameBoy
  • Virtua Fighter 2 - Genesis
  • Virtua Fighter - 32x

PvP games that support two models fighting each other:

  • Samurai Showdown - Genesis
  • WWF Wrestlemania the Arcade Game - Genesis
  • Mortal Kombat II - Genesis
  • NHL 94 - Genesis

As well as additional states on already integrated games.

Bug Fixes

  • Fixed UI flickering issue in OpenAI integration tool
  • fix compile with c++ >=17

Installation

pip3 install git+https://github.com/Farama-Foundation/stable-retro.git

Apple Silicon Installation (Tested on python3.10)

  • NOTE: The Game Boy (gambatte) emulator is not supported on Apple Silicon

Build from source

  1. pip install cmake wheel
  2. brew install pkg-config [email protected] libzip qt5 capnp
  3. echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc
  4. export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
  5. pip install -e .

Build Integration UI

  1. build package from source
  2. cmake . -DCMAKE_PREFIX_PATH=/usr/local/opt/qt -DBUILD_UI=ON -UPYLIB_DIRECTORY
  3. make -j$(sysctl hw.ncpu | cut -d: -f2)
  4. open "Gym Retro Integration.app"

Video on how to setup on Ubuntu and Windows: https://youtu.be/LRgGSQGNZeE

Docker image for M1 Macs: https://github.com/arvganesh/stable-retro-docker

Example

'Nature CNN' model trained using PPO on Airstriker-Genesis env (rom already included in the repo)

Tested on Ubuntu 20.04 and Windows 11 WSL2 (Ubuntu 20.04 VM)

sudo apt-get update
sudo apt-get install python3 python3-pip git zlib1g-dev libopenmpi-dev ffmpeg

You need to install a stable baselines 3 version that supports gymnasium

pip3 install git+https://github.com/Farama-Foundation/stable-retro.git
pip3 install "stable_baselines3[extra]>=2.0.0a9"

Start training:

cd retro/examples
python3 ppo.py --game='Airstriker-Genesis'

Citation

@misc{stable-retro,
  author = {Mathieu and Poliquin},
  title = {Stable Retro, a fork of OpenAI's gym-retro},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/MatPoliquin/stable-retro}},
}

Tutorials

Game Integration tool: https://www.youtube.com/playlist?list=PLmwlWbdWpZVvWqzOxu0jVBy-CaRpYha0t

Discord channel

Join here: https://discord.gg/dXuBSg3B4D

Stable Retro

Stable Retro lets you turn classic video games into Gymnasium environments for reinforcement learning and comes with integrations for ~1000 games. It uses various emulators that support the Libretro API, making it fairly easy to add new emulators.

Supported platforms:

  • Windows 7, 8, 10
  • macOS 10.13 (High Sierra), 10.14 (Mojave)
  • Linux (manylinux1)

CPU with SSSE3 or better

Supported Pythons:

  • 3.6
  • 3.7
  • 3.8

Each game integration has files listing memory locations for in-game variables, reward functions based on those variables, episode end conditions, savestates at the beginning of levels and a file containing hashes of ROMs that work with these files.

Please note that ROMs are not included and you must obtain them yourself. Most ROM hashes are sourced from their respective No-Intro SHA-1 sums.

Documentation

Documentation is available at https://retro.readthedocs.io/en/latest/

You should probably start with the Getting Started Guide.

Contributing

See CONTRIBUTING.md

There is an effort to get this project to the Farama Foundation Project Standards. These development efforts are being coordinated in the stable-retro channel of the Farama Foundation's Discord. Click here for the invite

Changelog

See CHANGES.md

Emulated Systems

  • Atari
    • Atari2600 (via Stella)
  • NEC
    • TurboGrafx-16/PC Engine (via Mednafen/Beetle PCE Fast)
  • Nintendo
    • Game Boy/Game Boy Color (via gambatte)
    • Game Boy Advance (via mGBA)
    • Nintendo Entertainment System (via FCEUmm)
    • Super Nintendo Entertainment System (via Snes9x)
  • Sega
    • GameGear (via Genesis Plus GX)
    • Genesis/Mega Drive (via Genesis Plus GX)
    • Master System (via Genesis Plus GX)

See LICENSES.md for information on the licenses of the individual cores.

Included ROMs

The following non-commercial ROMs are included with Stable Retro for testing purposes:

Citation

Please cite using the following BibTeX entry:

@article{nichol2018retro,
  title={Gotta Learn Fast: A New Benchmark for Generalization in RL},
  author={Nichol, Alex and Pfau, Vicki and Hesse, Christopher and Klimov, Oleg and Schulman, John},
  journal={arXiv preprint arXiv:1804.03720},
  year={2018}
}

stable-retro's People

Contributors

christopherhesse avatar cwgreene avatar darrellenns avatar eaplatanios avatar edoffagne avatar endrift avatar fgvbrt avatar fsimond avatar guillemdb avatar icoxfog417 avatar joshim5 avatar matpoliquin avatar mgoulao avatar mwidjaja1 avatar onaclov2000 avatar parmarsuraj99 avatar pisiiki avatar prabhatnagarajan avatar praveen-palanisamy avatar pseudo-rnd-thoughts avatar pum-purum-pum-pum avatar realcyguy avatar tristansokol avatar unixpickle avatar victorsevero avatar zbeucler2018 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.