RAM extraction mode
RAM Extraction submodule of OCAtari
- class ocatari.ram.game_objects.GameObject[source]
The Parent Class of every detected object in the Atari games (RAM Extraction mode)
- Variables:
category (str) – The Category of class name of the game object (e.g. Player, Ball).
x (int) – The x positional coordinate on the image (on the horizontal axis).
y (int) – The y positional coordinate on the image (on the vertical axis).
w (int) – The width/horizontal size of the object (in pixels).
h (int) – The height/vertical size of the object (in pixels).
prev_xy ((int, int)) – The positional coordinates x and y of the previous time step in a tuple.
xy – Both positional coordinates x and y in a tuple.
h_coords ([(int, int), (int, int)]) – History of coordinates, i.e. current (x, y) and previous (x, y) position.
dx (int) – The pixel movement corresponding to: current_x - previous_x.
dy (int) – The pixel movement corresponding to: current_y - previous_y.
xywh ((int, int, int, int)) – The positional and width/height coordinates in a single tuple (x, y, w, h).
orientation (int) – The orientation of the object (if available); game specific.
center ((int, int)) – The center of the bounding box of the object.
hud (bool) – True, if part of the Heads Up Display, and thus not interactable.
- Vartype:
- closest_object(others)[source]
Returns the closest object from others, based on manathan distance between the center of both objects.
- Returns:
(Index, Object) from others
- Return type:
- is_on_top(other)[source]
Returns
Trueif this and another gameobject overlap.- Returns:
True if objects overlap
- Return type:
- class ocatari.ram.game_objects.ValueObject[source]
This class represents a game object that incorporates any notion of a value. For example: * the score of the player (or sometimes Enemy). * the level of useable/deployable resources (oxygen bars, ammunition bars, power gauges, etc.) * the clock/timer
- Variables:
value (int) – The value of the score.
- closest_object(others)
Returns the closest object from others, based on manathan distance between the center of both objects.
- Returns:
(Index, Object) from others
- Return type:
- is_on_top(other)
Returns
Trueif this and another gameobject overlap.- Returns:
True if objects overlap
- Return type:
- manathan_distance(other)
Returns the manathan distance between the center of both objects.
- Returns:
True if objects overlap
- Return type:
Set of helper methods that are used in multiple Atari games
- ocatari.ram._helper_methods.bitfield_to_number(b, flip=False)[source]
Converts an int to a list of 1s and 0s which represent each bit of the input.
- ocatari.ram._helper_methods.get_iou(obj1, obj2)[source]
Computes the intersection over union between two GameObjects.

- Parameters:
obj1 (ocatari.ram.game_objects.GameObject or ocatari.vision.game_objects.GameObject) – The bouding box of the detected object in (x, y, w, h) format
obj2 (ocatari.ram.game_objects.GameObject or ocatari.vision.game_objects.GameObject) – The ground truth bouding box
- ocatari.ram._helper_methods.number_to_bitfield(n)[source]
Convert number to 8 bit bitfield.
Games like SpaceInvaders or Breakout use the bit representation of the number in the RAM to display or not display the objects. In most cases a 1 means the objects is displayed and a 0 means the object is not displayed. In SpaceInvaders the bit sequence needs to be reversed.