plangym.videogames.env

Plangym API implementation.

Module Contents

Classes

VideogameEnv

Common interface for working with video games that run using an emulator.

Attributes

LIFE_KEY

plangym.videogames.env.LIFE_KEY = lifes
class plangym.videogames.env.VideogameEnv(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.core.PlangymEnv, abc.ABC

Common interface for working with video games that run using an emulator.

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
DEFAULT_OBS_TYPE = rgb
property n_actions(self)

Return the number of actions available.

Return type

int

static get_lifes_from_info(info)[source]

Return the number of lifes remaining in the current game.

Parameters

info (Dict[str, Any]) –

Return type

int

apply_action(self, action)[source]

Evolve the environment for one time step applying the provided action.

clone(self, **kwargs)[source]

Return a copy of the environment.

Return type

VideogameEnv

begin_step(self, action=None, dt=None, state=None, return_state=None)[source]

Perform setup of step variables before starting step_with_dt.

Parameters

return_state (bool) –

Return type

None

init_spaces(self)[source]

Initialize the action_space and the observation_space of the environment.

Return type

None

process_obs(self, obs, **kwargs)[source]

Return the ram vector if obs_type == “ram” or and image otherwise.

abstract get_ram(self)[source]

Return the ram of the emulator as a numpy array.

Return type

numpy.ndarray