sc2_datasets.replay_parser.game_events.events.camera_update

Classes

CameraUpdate

CameraUpdate represents replay data regarding updated camera locations in the game.

Module Contents

class CameraUpdate

Bases: sc2_datasets.replay_parser.game_events.game_event.GameEvent

CameraUpdate represents replay data regarding updated camera locations in the game.

Parameters:
  • distance (None, float, int) – No valuable information about this parameter.

  • follow (bool) – No valuable information about this parameter.

  • id (int) – No valuable information about this parameter.

  • loop (int) – Game loop number (game-engine tick) at which the event occurred.

  • pitch (None, float, int) – Angle in the vertical plane, representing the vertical elevation of the camera.

  • reason (None, str) – No valuable information about this parameter.

  • target (Target2D | None) – Target class object containing x and y coordinates where the camera location was set.

  • userid (int) – ID of the player who saved the camera location.

  • yaw (None, float, int) – Angle in the horizontal plane of the camera.

distance: None | float | int
follow: bool
id: int
loop: int
pitch: None | float | int
reason: None | str
target: sc2_datasets.replay_parser.game_events.events.nested.target_2d.Target2D | None
userid: int
yaw: None | float | int
static from_dict(d: dict) CameraUpdate

Static method returning initialized CameraUpdate class from a dictionary. This aids in parsing the original JSON file extracted from a processed .SC2Replay file.

Parameters:

d (dict) – Dictionary obtained from the JSON file generated by preprocessing the .SC2Replay file.

Returns:

Initialized CameraUpdate class.

Return type:

CameraUpdate

Examples

Correct Usage Examples:

Using from_dict factory method provides ease of use when parsing a replay pre-processed with SC2InfoExtractorGo. This method requires a dictionary representation of data to be passed as a parameter because of the built-in json parser provided by the Python standard library.

>>> from sc2egset_dataset.dataset.replay_data.replay_parser.game_events.events.nested.target_2d import Target2D  #noqa
>>> camera_update_dict = {"distance": None,
...                       "follow": False,
...                       "id": 49,
...                       "loop": 136,
...                       "pitch": None,
...                       "reason": None,
...                       "target": {
...                           "x": 1.002,
...                           "y": 4.148},
...                       "userid": {"userId": 1},
...                       "yaw": None}
>>> camera_update_object = CameraUpdate.from_dict(d=camera_update_dict)
>>> assert isinstance(camera_update_object, CameraUpdate)
>>> assert camera_update_object.distance == None
>>> assert camera_update_object.follow == False
>>> assert camera_update_object.id == 49
>>> assert camera_update_object.loop == 136
>>> assert camera_update_object.pitch == None
>>> assert camera_update_object.reason == None
>>> assert camera_update_object.target.x == 1.002
>>> assert camera_update_object.target.y == 4.148
>>> assert camera_update_object.userid == 1
>>> assert camera_update_object.yaw == None