plangym.videogames.retro

Implement the plangym API for retro environments.

Module Contents

Classes

ActionDiscretizer

Wrap a gym-retro environment and make it use discrete actions for the Sonic game.

RetroEnv

Environment for playing gym-retro games.

class plangym.videogames.retro.ActionDiscretizer(env)[source]

Bases: gym.ActionWrapper

Wrap a gym-retro environment and make it use discrete actions for the Sonic game.

action(self, a)[source]

Return the corresponding action in the emulator’s format.

Return type

int

class plangym.videogames.retro.RetroEnv(name, frameskip=5, episodic_life=False, autoreset=True, delay_setup=False, remove_time_limit=True, obs_type='rgb', render_mode=None, wrappers=None, **kwargs)[source]

Bases: plangym.videogames.env.VideogameEnv

Environment for playing gym-retro games.

Parameters
  • name (str) –

  • frameskip (int) –

  • episodic_life (bool) –

  • autoreset (bool) –

  • delay_setup (bool) –

  • remove_time_limit (bool) –

  • obs_type (str) –

  • render_mode (Optional[str]) –

  • wrappers (Iterable[plangym.core.wrap_callable]) –

AVAILABLE_OBS_TYPES
SINGLETON = True
__getattr__(self, item)[source]

Forward getattr to self.gym_env.

static get_win_condition(info)[source]

Get win condition for games that have the end of the screen available.

Parameters

info (Dict[str, Any]) –

Return type

bool

get_ram(self)[source]

Return the ram of the emulator as a numpy array.

Return type

numpy.ndarray

clone(self, **kwargs)[source]

Return a copy of the environment with its initialization delayed.

Return type

RetroEnv

init_gym_env(self)[source]

Initialize the retro environment.

Return type

gym.Env

get_state(self)[source]

Get the state of the retro environment.

Return type

numpy.ndarray

set_state(self, state)[source]

Set the state of the retro environment.

Parameters

state (numpy.ndarray) –

close(self)[source]

Close the underlying gym.Env.