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
Frame dispatch to game agents is throttled to ensure:
Realistic APM (actions per minute)
Normalized intervals between actions
Natural gameplay feel
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
launch
Launches the game and runs callbacks.
Cannot be overwritten by plugins
play
play
Initializes and runs a game agent with specified frame handler.
Cannot be overwritten by plugins
Callbacks
Can be overwritten by plugins
after_launch
requiressuper()
callUsed for custom launch logic
Last updated