Skip to main content

Super Mario Bros. for OpenAI Gym

Project description

gym-super-mario-bros

PackageVersion PythonVersion Stable Format License

walk1 walk2 walk3 jump

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 occurrences. If a cut-scene is not able to be skipped by hacking the NES's RAM, the environment will lock the Python process until the emulator is ready for the next action.

Environment Game Frameskip ROM Screenshot
SuperMarioBros-v0 SMB 4 standard
SuperMarioBros-v1 SMB 4 down-sampled
SuperMarioBros-v2 SMB 4 pixelated
SuperMarioBros-v3 SMB 4 rectangles
SuperMarioBrosNoFrameskip-v0 SMB 1 standard
SuperMarioBrosNoFrameskip-v1 SMB 1 down-sampled
SuperMarioBrosNoFrameskip-v2 SMB 1 pixelated
SuperMarioBrosNoFrameskip-v3 SMB 1 rectangles
SuperMarioBros2-v0 SMB2 4 standard
SuperMarioBros2-v1 SMB2 4 down-sampled
SuperMarioBros2NoFrameskip-v0 SMB2 1 standard
SuperMarioBros2NoFrameskip-v1 SMB2 1 down-sampled

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

gym_super_mario_bros-0.11.2.tar.gz (197.8 kB view details)

Uploaded Source

File details

Details for the file gym_super_mario_bros-0.11.2.tar.gz.

File metadata

File hashes

Hashes for gym_super_mario_bros-0.11.2.tar.gz
Algorithm Hash digest
SHA256 a9c0adcee337bb44c735b6e5c088d72c8c9c95805cde65451e0a4422e216d58f
MD5 94a69237bd95c81d8fb4a1774a3eab22
BLAKE2b-256 561b7a2e63267d18966400d2fdb723aaab6ab00dd2350be76a8eee7aa74900c4

See more details on using hashes here.

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