mini_arcade_core.engine.commands

Command protocol for executing commands with a given context.

Attributes

Classes

CommandContext

Context for command execution.

Command

A command is the only allowed "write path" from input/systems into:

CommandQueue

Queue for storing and executing commands.

QuitCommand

Quit the game.

ScreenshotCommand

Take a screenshot.

PushSceneCommand

Push a new scene onto the scene stack.

PopSceneCommand

Pop the current scene from the scene stack.

ChangeSceneCommand

Change the current scene to the specified scene.

PushSceneIfMissingCommand

Push a scene only if it is not already in the stack.

RemoveSceneCommand

Remove a specific scene instance from the scene stack.

ToggleDebugOverlayCommand

Toggle the debug overlay scene.

ToggleEffectCommand

Toggle a post-processing effect on or off.

StartReplayRecordCommand

Start recording a replay to the specified file.

StopReplayRecordCommand

Stop recording the current replay.

StartReplayPlayCommand

Start playing back a replay from the specified file.

StopReplayPlayCommand

Stop playing back the current replay.

StartVideoRecordCommand

Start recording a video.

StopVideoRecordCommand

Stop recording the current video.

ToggleVideoRecordCommand

Toggle video recording on or off.

Module Contents

mini_arcade_core.engine.commands.TContext
class mini_arcade_core.engine.commands.CommandContext

Context for command execution.

Variables:
  • (RuntimeServices) (services) – The runtime services.

  • None) (world (object |) – Optional command queue.

  • None) – Optional settings object.

  • None) – The world object (can be any type).

services: mini_arcade_core.runtime.services.RuntimeServices
managers: object
settings: object | None = None
world: object | None = None
class mini_arcade_core.engine.commands.Command

Bases: Protocol

A command is the only allowed “write path” from input/systems into: - scene operations (push/pop/change/quit) - capture - global game lifecycle - later: world mutations (if you pass a world reference)

For now we keep it simple: commands only need RuntimeServices.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.CommandQueue

Queue for storing and executing commands.

push(cmd: Command)

Push a command onto the queue.

Parameters:

cmd (Command) – Command to be added to the queue.

drain() List[Command]

Drain and return all commands from the queue.

Returns:

List of commands that were in the queue.

Return type:

list[Command]

class mini_arcade_core.engine.commands.QuitCommand

Bases: Command

Quit the game.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.ScreenshotCommand

Bases: Command

Take a screenshot.

Variables:

None) (label (str |) – Optional label for the screenshot file.

label: str | None = None
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.PushSceneCommand

Bases: Command

Push a new scene onto the scene stack.

Variables:
  • (str) (scene_id) – Identifier of the scene to push.

  • (bool) (as_overlay) – Whether to push the scene as an overlay.

scene_id: str
as_overlay: bool = False
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.PopSceneCommand

Bases: Command

Pop the current scene from the scene stack.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.ChangeSceneCommand

Bases: Command

Change the current scene to the specified scene.

Variables:

(str) (scene_id) – Identifier of the scene to switch to.

scene_id: str
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.PushSceneIfMissingCommand

Bases: Command

Push a scene only if it is not already in the stack.

scene_id: str
as_overlay: bool = False
policy: mini_arcade_core.engine.scenes.models.ScenePolicy | None = None
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.RemoveSceneCommand

Bases: Command

Remove a specific scene instance from the scene stack.

scene_id: str
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.ToggleDebugOverlayCommand

Bases: Command

Toggle the debug overlay scene.

Variables:

DEBUG_OVERLAY_ID – str: Identifier for the debug overlay scene.

DEBUG_OVERLAY_ID = 'debug_overlay'
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.ToggleEffectCommand

Bases: Command

Toggle a post-processing effect on or off.

Variables:

(str) (effect_id) – Identifier of the effect to toggle.

effect_id: str
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StartReplayRecordCommand

Bases: Command

Start recording a replay to the specified file.

Variables:
  • (str) (initial_scene) – The filename to save the replay to.

  • (str) – Identifier of the game.

  • (str) – The initial scene of the replay.

  • (int) (fps) – The random seed used in the replay.

  • (int) – Frames per second for the replay.

filename: str
game_id: str = 'mini-arcade'
initial_scene: str = 'unknown'
seed: int = 0
fps: int = 60
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StopReplayRecordCommand

Bases: Command

Stop recording the current replay.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StartReplayPlayCommand

Bases: Command

Start playing back a replay from the specified file.

Variables:
  • (str) (path) – The path to the replay file.

  • (bool) (change_scene) – Whether to change to the replay’s initial scene.

path: str
change_scene: bool = True
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StopReplayPlayCommand

Bases: Command

Stop playing back the current replay.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StartVideoRecordCommand

Bases: Command

Start recording a video.

Variables:
  • (int) (capture_fps) – Frames per second for the video.

  • (int) – Frames per second for capturing frames.

fps: int = 60
capture_fps: int = 30
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.StopVideoRecordCommand

Bases: Command

Stop recording the current video.

execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).

class mini_arcade_core.engine.commands.ToggleVideoRecordCommand

Bases: Command

Toggle video recording on or off.

Variables:
  • (int) (capture_fps) – Frames per second for the video.

  • (int) – Frames per second for capturing frames.

fps: int = 60
capture_fps: int = 30
execute(context: CommandContext)

Execute the command with the given world and runtime services.

Parameters:
  • services (RuntimeServices) – Runtime services for command execution.

  • commands (object | None) – Optional command queue for command execution.

  • settings (object | None) – Optional settings object for command execution.

  • world (object | None) – The world object (can be any type).