mini_arcade_core.runtime.capture.replay_format

Replay file format for mini-arcade.

Attributes

Classes

ReplayHeader

Header information for a mini-arcade replay file.

ReplayWriter

Replay file writer.

ReplayReader

Replay file reader.

Module Contents

mini_arcade_core.runtime.capture.replay_format.REPLAY_MAGIC = 'mini-arcade-replay'
mini_arcade_core.runtime.capture.replay_format.REPLAY_VERSION = 1
class mini_arcade_core.runtime.capture.replay_format.ReplayHeader

Header information for a mini-arcade replay file.

Variables:
  • magic – Magic string to identify the file type.

  • version – Version of the replay format.

  • game_id – Identifier for the game.

  • initial_scene – Name of the initial scene.

  • seed – Seed used for random number generation.

  • fps – Frames per second of the replay.

magic: str = 'mini-arcade-replay'
version: int = 1
game_id: str = 'unknown'
initial_scene: str = 'unknown'
seed: int = 0
fps: int = 60
class mini_arcade_core.runtime.capture.replay_format.ReplayWriter(path: pathlib.Path, header: ReplayHeader)

Replay file writer.

path
header
open() None

Open the replay file for writing.

write_frame(frame: mini_arcade_core.runtime.input_frame.InputFrame) None

Write an input frame to the replay file.

Parameters:

frame (InputFrame) – Input frame to write.

close() None

Close the replay file.

class mini_arcade_core.runtime.capture.replay_format.ReplayReader(path: pathlib.Path)

Replay file reader.

path
header: ReplayHeader | None = None
open() ReplayHeader

Open the replay file for reading.

Returns:

The replay header.

Return type:

ReplayHeader

frames() Iterator[mini_arcade_core.runtime.input_frame.InputFrame]

Iterate over input frames in the replay file.

Returns:

Input frames from the replay.

Return type:

Iterator[InputFrame]

close() None

Close the replay file.