Super Mario Bros. for OpenAI Gym
Project description
gym-super-mario-bros
An OpenAI Gym environment for Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The Nintendo Entertainment System (NES).
Installation
The preferred installation of gym-super-mario-bros
is from pip
:
pip install gym-super-mario-bros
NES Emulator
gym-super-mario-bros
uses FCEUX to emulate NES games.
Make sure it's installed and in your $PATH
.
Unix
sudo apt-get install fceux
Mac
brew install fceux
Usage
You must import gym_super_mario_bros
before trying to make an environment. This is
because gym environments are registered at runtime.
import gym_super_mario_bros
env = gym_super_mario_bros.make('SuperMarioBros-v0')
done = True
for step in range(5000):
if done:
state = env.reset()
state, reward, done, info = env.step(env.action_space.sample())
env.close()
NOTE: gym_super_mario_bros.make
is just an alias to gym.make
for
convenience.
Environments
These environments allow 3 attempts (lives) to make it through the 32 levels of the game. The environments only send reward-able game-play frames to agents; No cut-scenes, loading screens, etc. are sent from the NES emulator to an agent nor can an agent perform actions during these occurences. If a cut-scene is not able to be skipped by hacking the NES's RAM, the environment will lock the Pyton process until the emulator is ready for the next action.
Environment | Game | Description |
---|---|---|
SuperMarioBros-v0 |
SMB | 4 frames per action, standard ROM |
SuperMarioBros-v1 |
SMB | 4 frames per action, custom down-sampled ROM |
SuperMarioBrosNoFrameskip-v0 |
SMB | 1 frame per action, standard ROM |
SuperMarioBrosNoFrameskip-v1 |
SMB | 1 frame per action, custom down-sampled ROM |
SuperMarioBros2-v0 |
SMB2 | 4 frames per action, standard ROM |
SuperMarioBros2-v1 |
SMB2 | 4 frames per action, custom down-sampled ROM |
SuperMarioBros2NoFrameskip-v0 |
SMB2 | 1 frame per action, standard ROM |
SuperMarioBros2NoFrameskip-v1 |
SMB2 | 1 frame per action, custom down-sampled ROM |
Citation
Please cite gym-super-mario-bros
if you use it in your research.
@misc{gym-super-mario-bros,
author = {Christian Kauten},
title = {{S}uper {M}ario {B}ros for {O}pen{AI} {G}ym},
year = {2018},
publisher = {GitHub},
howpublished = {\url{https://github.com/Kautenja/gym-super-mario-bros}},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for gym_super_mario_bros-0.10.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | be09963c54a22caa344030a5601bb4e68d9e50123939035c03edef0af62cd391 |
|
MD5 | 9034d6959c422a360e72f5d8132822b1 |
|
BLAKE2b-256 | 4bde81e3effc43074bfa49186e0bfd1fbb5dae36ae0f9c43c24d8a9b08051ed2 |