Game Class

The Game class represents a generic video game in the Bluetang framework.

Core Components

  • Launch game through GameLauncher

  • Manage game window information

  • Control FrameGrabber instances

  • Feed GameFrames to GameAgent

  • Throttle frame feed speed

  • Expose game-specific API

  • Register and manage game sprites

  • Manage regions of interest

  • Handle OCR presets

Key Concepts

Frame Grabbing

When play is called, a FrameGrabber runs in the background as a separate process:

  • Maintains precise capture rate (default: 30 FPS)

  • Stores image data in memory stack

  • Automatically shuts down with main process

Game Frame Limiter

Default limit: 2 FPS (120 APM theoretical maximum) Configure in: config/config.plugins.yml

Game API

Game Plugins can include GameAPI subclasses with:

  • Game-specific utilities

  • UI operations

  • Image processing routines

Sprites & Regions

  • Sprites: Auto-registered from files/data/sprites

  • Screen Regions: Define rectangular regions of interest

  • OCR Presets: Configure text recognition settings

Methods

launch

def launch(self, dry_run=False)

Launches the game and runs callbacks.

play

def play(self, game_agent_class_name=None, frame_handler=None, **kwargs)

Initializes and runs a game agent with specified frame handler.

Callbacks

def before_launch(self)
def after_launch(self)
  • Can be overwritten by plugins

  • after_launch requires super() call

  • Used for custom launch logic

Last updated