Plugin base classes

class pyboy.plugins.base_plugin.PyBoyGameWrapper(*args, game_area_section=(0, 0, 32, 32), game_area_follow_scxy=False, **kwargs)[source]

Bases: PyBoyPlugin

This is the base-class for the game-wrappers. It provides some generic game-wrapping functionality, like game_area , which shows both sprites and tiles on the screen as a simple matrix.

mapping_one_to_one

1

Type:

Example mapping of 1

shape

The shape of the game area. This can be modified with pyboy.PyBoy.game_area_dimensions.

Example:

>>> pyboy.game_wrapper.shape
(32, 32)
start_game(timer_div=None)[source]

Call this function right after initializing PyBoy. This will navigate through menus to start the game at the first playable state.

A value can be passed to set the timer’s DIV register. Some games depend on it for randomization.

The state of the emulator is saved, and using reset_game, you can get back to this point of the game instantly.

Parameters:

timer_div (int) – Replace timer’s DIV register with this value. Use None to randomize.

reset_game(timer_div=None)[source]

After calling start_game, you can call this method at any time to reset the game.

Parameters:

timer_div (int) – Replace timer’s DIV register with this value. Use None to randomize.

game_over()[source]

After calling start_game, you can call this method at any time to know if the game is over.

game_area()[source]

This method returns a cut-out of the screen as a simplified matrix for use in machine learning applications.

Returns:

Simplified two-dimensional array of mapped tile identifiers with dtype numpy.uint32.

Return type:

numpy.ndarray

game_area_annotations()[source]

Return (x, y, text) annotations in native screen-pixel coordinates.