Skip to main content

No project description provided

Project description

pre-commit Code style: black

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 platforms. Since gym-retro is in maintenance now and doesn't accept new games, platforms 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 - 32x
  • Virtua Fighter 2 - Genesis
  • Virtua Fighter 2 - Saturn
  • Mortal Kombat 1 - Sega CD

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.

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)
    • 32x (via Picodrive)
    • Saturn (via Beetle Saturn)
    • Sega CD (via Genesis Plus GX)

Experimental (accessible in the fbneo branch)

  • Arcade Machines:
    • Neo Geo (MVS hardware: 1990–2004)
    • Sega System 1 (1983–1987)
    • Sega System 16 (And similar. 1985–1994)
    • Sega System 18 (1989–1992)
    • Sega System 24 (1988–1994)
    • Capcom CPS1 (1988–1995)
    • Capcom CPS2 (1993–2003)
    • Capcom CPS3 (1996–1999)

Full list of supported Arcade machines here

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 lua@5.1 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]

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 = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/Farama-Foundation/stable-retro}},
}

Tutorials

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

Discord channel

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

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

Supported specs:

Plateforms:

  • Windows 10, 11 (via WSL2)
  • macOS 10.13 (High Sierra), 10.14 (Mojave)
  • Linux (manylinux1)

CPU with SSSE3 or better

Supported Pythons: 3.7 to 3.10

Documentation

Documentation is available at https://stable-retro.farama.org/ (work in progress)

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

ROMs

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stable-retro-0.9.2.tar.gz (111.1 MB view hashes)

Uploaded Source

Built Distributions

stable_retro-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl (95.3 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

stable_retro-0.9.2-cp39-cp39-manylinux_2_28_x86_64.whl (95.3 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

stable_retro-0.9.2-cp38-cp38-manylinux_2_28_x86_64.whl (95.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page