[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
# Stable-Retro
A fork of [gym-retro](https://github.com/openai/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](https://emulation.gametechwiki.com/index.php/FinalBurn_Neo)
## 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](https://github.com/Farama-Foundation/stable-retro/blob/master/CONTRIBUTING.md)
There is an effort to get this project to the [Farama Foundation Project Standards](https://farama.org/project_standards). These development efforts are being coordinated in the `stable-retro` channel of the Farama Foundation's Discord. Click [here](https://discord.gg/aPjhD5cf) 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/](https://stable-retro.farama.org/) (work in progress)
See [LICENSES.md](https://github.com/Farama-Foundation/stable-retro/blob/master/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:
- [the 128 sine-dot](http://www.pouet.net/prod.php?which=2762) by Anthrox
- [Sega Tween](https://pdroms.de/files/gamegear/sega-tween) by Ben Ryves
- [Happy 10!](http://www.pouet.net/prod.php?which=52716) by Blind IO
- [512-Colour Test Demo](https://pdroms.de/files/pcengine/512-colour-test-demo) by Chris Covell
- [Dekadrive](http://www.pouet.net/prod.php?which=67142) by Dekadence
- [Automaton](https://pdroms.de/files/atari2600/automaton-minigame-compo-2003) by Derek Ledbetter
- [Fire](http://privat.bahnhof.se/wb800787/gb/demo/64/) by dox
- [FamiCON intro](http://www.pouet.net/prod.php?which=53497) by dr88
- [Airstriker](https://pdroms.de/genesis/airstriker-v1-50-genesis-game) by Electrokinesis
- [Lost Marbles](https://pdroms.de/files/gameboyadvance/lost-marbles) by Vantage
Raw data
{
"_id": null,
"home_page": "https://github.com/farama-foundation/stable-retro",
"name": "stable-retro",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.0,<3.11",
"maintainer_email": "",
"keywords": "",
"author": "Farama Foundation",
"author_email": "contact@farama.org",
"download_url": "https://files.pythonhosted.org/packages/39/b3/befcc36eca41c11b9491b8eb2ed22fa0a4b47810f053858455186ac530a0/stable-retro-0.9.2.tar.gz",
"platform": null,
"description": "[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://pre-commit.com/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# Stable-Retro\n\nA fork of [gym-retro](https://github.com/openai/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.\n\nCurrently added games on top of gym-retro:\n*\tSuper Mario Bros 2 Japan (Lost Levels) - NES\n*\tHang On - SMS\n*\tPunch Out - NES\n*\tWWF Wrestlemania the Arcade Game - Genesis\n*\tNHL 94 - Genesis\n*\tNHL 94 (1 on 1 rom hack) - Genesis\n*\tSuper Hang On - Genesis\n*\tTetris - GameBoy\n*\tVirtua Fighter - 32x\n*\tVirtua Fighter 2 - Genesis\n*\tVirtua Fighter 2 - Saturn\n*\tMortal Kombat 1 - Sega CD\n\nPvP games that support two models fighting each other:\n*\tSamurai Showdown - Genesis\n*\tWWF Wrestlemania the Arcade Game - Genesis\n*\tMortal Kombat II - Genesis\n*\tNHL 94 - Genesis\n\nAs well as additional states on already integrated games.\n\n## Emulated Systems\n\n- Atari\n\t- Atari2600 (via Stella)\n- NEC\n\t- TurboGrafx-16/PC Engine (via Mednafen/Beetle PCE Fast)\n- Nintendo\n\t- Game Boy/Game Boy Color (via gambatte)\n\t- Game Boy Advance (via mGBA)\n\t- Nintendo Entertainment System (via FCEUmm)\n\t- Super Nintendo Entertainment System (via Snes9x)\n- Sega\n\t- GameGear (via Genesis Plus GX)\n\t- Genesis/Mega Drive (via Genesis Plus GX)\n\t- Master System (via Genesis Plus GX)\n \t- 32x (via Picodrive)\n \t- Saturn (via Beetle Saturn)\n \t- Sega CD (via Genesis Plus GX)\n\n**Experimental** (accessible in the fbneo branch)\n- Arcade Machines:\n \t- Neo Geo (MVS hardware: 1990\u20132004)\n \t- Sega System 1 (1983\u20131987)\n \t- Sega System 16 (And similar. 1985\u20131994)\n \t- Sega System 18 (1989\u20131992)\n \t- Sega System 24 (1988\u20131994)\n \t- Capcom CPS1 (1988\u20131995)\n \t- Capcom CPS2 (1993\u20132003)\n \t- Capcom CPS3 (1996\u20131999)\n\n[Full list of supported Arcade machines here](https://emulation.gametechwiki.com/index.php/FinalBurn_Neo)\n\n## Installation\n```\npip3 install git+https://github.com/Farama-Foundation/stable-retro.git\n```\n#### Apple Silicon Installation (Tested on python3.10)\n- NOTE: The Game Boy (gambatte) emulator is not supported on Apple Silicon\n\n**Build from source**\n1. `pip install cmake wheel`\n2. `brew install pkg-config lua@5.1 libzip qt5 capnp`\n3. `echo 'export PATH=\"/opt/homebrew/opt/qt@5/bin:$PATH\"' >> ~/.zshrc`\n4. `export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)`\n5. `pip install -e .`\n\n**Build Integration UI**\n1. build package from source\n2. `cmake . -DCMAKE_PREFIX_PATH=/usr/local/opt/qt -DBUILD_UI=ON -UPYLIB_DIRECTORY`\n3. `make -j$(sysctl hw.ncpu | cut -d: -f2)`\n4. `open \"Gym Retro Integration.app\"`\n\n\nVideo on how to setup on Ubuntu and Windows:\nhttps://youtu.be/LRgGSQGNZeE\n\nDocker image for M1 Macs:\nhttps://github.com/arvganesh/stable-retro-docker\n\n## Example\n\n'Nature CNN' model trained using PPO on Airstriker-Genesis env (rom already included in the repo)\n\nTested on Ubuntu 20.04 and Windows 11 WSL2 (Ubuntu 20.04 VM)\n```\nsudo apt-get update\nsudo apt-get install python3 python3-pip git zlib1g-dev libopenmpi-dev ffmpeg\n```\nYou need to install a stable baselines 3 version that supports gymnasium\n```\npip3 install git+https://github.com/Farama-Foundation/stable-retro.git\npip3 install stable_baselines3[extra]\n```\n\nStart training:\n```\ncd retro/examples\npython3 ppo.py --game='Airstriker-Genesis'\n```\n\n## Citation\n\n```\n@misc{stable-retro,\n author = {Mathieu and Poliquin},\n title = {Stable Retro, a fork of OpenAI's gym-retro},\n year = {2023},\n publisher = {GitHub},\n journal = {GitHub repository},\n howpublished = {\\url{https://github.com/Farama-Foundation/stable-retro}},\n}\n```\n\n## Tutorials\n\nGame Integration tool:\nhttps://www.youtube.com/playlist?list=PLmwlWbdWpZVvWqzOxu0jVBy-CaRpYha0t\n\n## Discord channel\n\nJoin here:\nhttps://discord.gg/dXuBSg3B4D\n\n## Contributing\n\n[See CONTRIBUTING.md](https://github.com/Farama-Foundation/stable-retro/blob/master/CONTRIBUTING.md)\n\nThere is an effort to get this project to the [Farama Foundation Project Standards](https://farama.org/project_standards). These development efforts are being coordinated in the `stable-retro` channel of the Farama Foundation's Discord. Click [here](https://discord.gg/aPjhD5cf) for the invite\n\n## Supported specs:\n\nPlateforms:\n- Windows 10, 11 (via WSL2)\n- macOS 10.13 (High Sierra), 10.14 (Mojave)\n- Linux (manylinux1)\n\nCPU with `SSSE3` or better\n\nSupported Pythons: 3.7 to 3.10\n\n## Documentation\n\nDocumentation is available at [https://stable-retro.farama.org/](https://stable-retro.farama.org/) (work in progress)\n\nSee [LICENSES.md](https://github.com/Farama-Foundation/stable-retro/blob/master/LICENSES.md) for information on the licenses of the individual cores.\n\n## ROMs\n\nEach 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.\n\nPlease 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.\n\nThe following non-commercial ROMs are included with Stable Retro for testing purposes:\n\n- [the 128 sine-dot](http://www.pouet.net/prod.php?which=2762) by Anthrox\n- [Sega Tween](https://pdroms.de/files/gamegear/sega-tween) by Ben Ryves\n- [Happy 10!](http://www.pouet.net/prod.php?which=52716) by Blind IO\n- [512-Colour Test Demo](https://pdroms.de/files/pcengine/512-colour-test-demo) by Chris Covell\n- [Dekadrive](http://www.pouet.net/prod.php?which=67142) by Dekadence\n- [Automaton](https://pdroms.de/files/atari2600/automaton-minigame-compo-2003) by Derek Ledbetter\n- [Fire](http://privat.bahnhof.se/wb800787/gb/demo/64/) by dox\n- [FamiCON intro](http://www.pouet.net/prod.php?which=53497) by dr88\n- [Airstriker](https://pdroms.de/genesis/airstriker-v1-50-genesis-game) by Electrokinesis\n- [Lost Marbles](https://pdroms.de/files/gameboyadvance/lost-marbles) by Vantage\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "",
"version": "0.9.2",
"project_urls": {
"Homepage": "https://github.com/farama-foundation/stable-retro"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae94072b7776cf61dc92e45f220d5980687f7a3bfb36c71ae156d7a56de32d5a",
"md5": "40bc2fe9a8c57dde605a164b6e21cf67",
"sha256": "20ec47c45130e6eab28d0ee70a1823ca385ec1743b332759f688aed84129d391"
},
"downloads": -1,
"filename": "stable_retro-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "40bc2fe9a8c57dde605a164b6e21cf67",
"packagetype": "bdist_wheel",
"python_version": "cp310",
"requires_python": ">=3.8.0,<3.11",
"size": 95263251,
"upload_time": "2023-10-16T07:21:52",
"upload_time_iso_8601": "2023-10-16T07:21:52.267774Z",
"url": "https://files.pythonhosted.org/packages/ae/94/072b7776cf61dc92e45f220d5980687f7a3bfb36c71ae156d7a56de32d5a/stable_retro-0.9.2-cp310-cp310-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b2f0b478739d00cf68a7faf59818b903ecf5b1bb92968eb301a0b875b612daea",
"md5": "b27a91abe9036e88a630894070c3c76b",
"sha256": "e17facd0484b7db527518165a0c396b7bbd5bdd68d40f5dffc05bc59d36ac39f"
},
"downloads": -1,
"filename": "stable_retro-0.9.2-cp38-cp38-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "b27a91abe9036e88a630894070c3c76b",
"packagetype": "bdist_wheel",
"python_version": "cp38",
"requires_python": ">=3.8.0,<3.11",
"size": 95245091,
"upload_time": "2023-10-16T07:21:58",
"upload_time_iso_8601": "2023-10-16T07:21:58.988801Z",
"url": "https://files.pythonhosted.org/packages/b2/f0/b478739d00cf68a7faf59818b903ecf5b1bb92968eb301a0b875b612daea/stable_retro-0.9.2-cp38-cp38-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3ea3798679c85f320cbfbcb018b1fd93d4eee456e9f95d8e039e77b81c5a9262",
"md5": "5036787dc58e5d9e781a30a771aedd2a",
"sha256": "f7af1655f145c5b13559739950f4a2160e69a22bb8f326dbfeb2a4f1939ec0b4"
},
"downloads": -1,
"filename": "stable_retro-0.9.2-cp39-cp39-manylinux_2_28_x86_64.whl",
"has_sig": false,
"md5_digest": "5036787dc58e5d9e781a30a771aedd2a",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.8.0,<3.11",
"size": 95261940,
"upload_time": "2023-10-16T07:22:05",
"upload_time_iso_8601": "2023-10-16T07:22:05.396187Z",
"url": "https://files.pythonhosted.org/packages/3e/a3/798679c85f320cbfbcb018b1fd93d4eee456e9f95d8e039e77b81c5a9262/stable_retro-0.9.2-cp39-cp39-manylinux_2_28_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "39b3befcc36eca41c11b9491b8eb2ed22fa0a4b47810f053858455186ac530a0",
"md5": "3d72264c789b0f9905646d8d97defcd1",
"sha256": "240861fc4088fef00f0cee97c8d16d0ec1965827111429c4660d2405620a40f0"
},
"downloads": -1,
"filename": "stable-retro-0.9.2.tar.gz",
"has_sig": false,
"md5_digest": "3d72264c789b0f9905646d8d97defcd1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.0,<3.11",
"size": 111083972,
"upload_time": "2023-10-16T07:22:12",
"upload_time_iso_8601": "2023-10-16T07:22:12.181741Z",
"url": "https://files.pythonhosted.org/packages/39/b3/befcc36eca41c11b9491b8eb2ed22fa0a4b47810f053858455186ac530a0/stable-retro-0.9.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-16 07:22:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "farama-foundation",
"github_project": "stable-retro",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stable-retro"
}