src.plangym.videogames.env#

Plangym API implementation.

Attributes#

Classes#

VideogameEnv

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

Module Contents#

src.plangym.videogames.env.LIFE_KEY = 'lifes'#
class src.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 (str | None)

  • wrappers (Iterable[plangym.core.wrap_callable] | None)

AVAILABLE_OBS_TYPES#
DEFAULT_OBS_TYPE = 'rgb'#
episodic_life#
_info_step#
property n_actions: int#

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(action)[source]#

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

clone(**kwargs)[source]#

Return a copy of the environment.

Return type:

VideogameEnv

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

Perform setup of step variables before starting step_with_dt.

Parameters:

return_state (bool | None)

Return type:

None

init_spaces()[source]#

Initialize the action_space and the observation_space of the environment.

Return type:

None

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

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

abstract get_ram()[source]#

Return the ram of the emulator as a numpy array.

Return type:

numpy.ndarray