Skip to content

Wrappers

Christian Kauten edited this page Jun 2, 2019 · 20 revisions

Wrappers for altering the behavior of gym environments.

JoypadSpace

A wrapper to define a much smaller action space. The initializer takes an environment and a list of button lists:

from nes_py.wrappers import JoypadSpace
env = JoypadSpace(env, [
    ['NOP'],
    ['right', 'A'],
    ['left', 'A'],
    ['A'],
])

Each button list should contain at least one of:

  • 'right'
  • 'left'
  • 'down'
  • 'up'
  • 'start'
  • 'select'
  • 'B'
  • 'A'
  • 'NOP'

Note

It is recommended for custom environments to use this wrapper by default. If there are multiple mappings, the package should provide each list and either register a different environment for each, or make note in the documentation for end users. See gym-super-mario-bros for an example of multiple button lists in the actions.py module.

Clone this wiki locally