Super Mario Bros. for OpenAI Gym
Project description
gym-zelda-1
An OpenAI Gym environment for The Legend of Zelda (i.e., Zelda 1) on The Nintendo Entertainment System (NES) based on the nes-py emulator.
Installation
The preferred installation of gym-zelda-1
is from pip
:
pip install gym-zelda-1
Usage
Python
You must import gym_zelda_1
before trying to make an environment.
This is because gym environments are registered at runtime. By default,
gym_zelda_1
environments use the full NES action space of 256
discrete actions. To contstrain this, gym_zelda_1.actions
provides
three actions lists (RIGHT_ONLY
, SIMPLE_MOVEMENT
, and COMPLEX_MOVEMENT
)
for the nes_py.wrappers.BinarySpaceToDiscreteSpaceEnv
wrapper. See
gym_zelda_1/actions.py for a
breakdown of the legal actions in each of these three lists.
from nes_py.wrappers import BinarySpaceToDiscreteSpaceEnv
import gym_zelda_1
from gym_zelda_1.actions import SIMPLE_MOVEMENT
env = gym_zelda_1.make('Zelda1-v0')
env = BinarySpaceToDiscreteSpaceEnv(env, SIMPLE_MOVEMENT)
done = True
for step in range(5000):
if done:
state = env.reset()
state, reward, done, info = env.step(env.action_space.sample())
env.render()
env.close()
NOTE: gym_zelda_1.make
is just an alias to gym.make
for
convenience.
NOTE: remove calls to render
in training code for a nontrivial
speedup.
Command Line
gym_zelda_1
features a command line interface for playing
environments using either the keyboard, or uniform random movement.
gym_zelda_1 -m <`human` or `random`>
Step
Info about the rewards and info returned by the step
method.
Reward Function
TODO
info
dictionary
The info
dictionary returned by the step
method contains the following
keys:
Key | Type | Description |
---|---|---|
x_pos |
int |
Link's x position in the screen (from the left) |
y_pos |
int |
Link's y position in the screen (from the top) |
direction |
str |
Link's direction as one of {"N", "S", "E", "W"} |
Citation
Please cite gym-zelda-1
if you use it in your research.
@misc{gym-zelda-1,
author = {Christian Kauten},
title = {{The Legend of Zelda} for {OpenAI Gym}},
year = {2019},
publisher = {GitHub},
howpublished = {\url{https://github.com/Kautenja/gym-zelda-1}},
}
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
Built Distribution
Hashes for gym_zelda_1-0.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b80bb8c5953535197b02349abcc1582b24095e7f17186e8abe14ebe45040418 |
|
MD5 | dd2e9f41d48adba2f2cdb63d6806e75b |
|
BLAKE2b-256 | adc9f2875907574581e4653d43276a3d70b8ec21839de1b6ef78e8ae27e7f991 |