Skip to content
claude-player logo

claude-player

An AI-powered Game Boy emulator agent that uses Claude's vision and reasoning to autonomously play Game Boy games.

SKILL.md

Full skill instructions

ClaudePlayer

An AI agent that plays Game Boy games autonomously using Claude's vision capabilities and the PyBoy emulator.

Overview

ClaudePlayer connects Claude to a Game Boy emulator. Each turn, Claude receives a screenshot of the current game frame, reasons about what to do, and sends button inputs back to the emulator. It maintains a structured memory system to track game progress (items, NPCs, locations, quests, stats).

Prerequisites

  • Python 3.10+
  • Pipenv
  • An Anthropic API key
  • A Game Boy ROM file (.gb)

Setup

# Install dependencies
pipenv install

# Create .env with your API key
echo "ANTHROPIC_API_KEY=your_key_here" > .env

# Place a Game Boy ROM in the project directory

Configuration

Edit config.json:

KeyDescriptionDefault
ROM_PATHPath to Game Boy ROMRequired
STATE_PATHSaved emulator state filenull
EMULATION_MODE"turn_based" or "continuous""turn_based"
MODEL_DEFAULTS.MODELClaude model to use"claude-sonnet-4-5-20250929"
MODEL_DEFAULTS.THINKINGEnable extended thinkingtrue
RATE_LIMITS.RPM_THRESHOLDRequests per minute limitConfigured in file
RATE_LIMITS.TPM_THRESHOLDTokens per minute limitConfigured in file
REDIS_LOGSOptional Redis logging confignull

Running

pipenv shell

# Default config
python play.py

# Custom config
python play.py --config my_config.json

# Create a saved emulator state
python emu_setup.py

Project Structure

PathPurpose
play.pyLauncher script
claude_player/​main.pyCLI entry point with arg parsing
claude_player/​agent/​game_agent.pyMain orchestrator: emulator init, game loop, coordination
claude_player/​interface/​claude_interface.pyClaude API communication and rate limiting
claude_player/​state/​game_state.pyGame state tracking (memory, goals, history)
claude_player/​tools/​tool_setup.pyTool definitions (send_inputs, memory ops, etc.)
claude_player/​tools/​tool_registry.pyTool registry system
claude_player/​config/​config_loader.pyConfig file parsing
claude_player/​config/​config_class.pyConfiguration data class
claude_player/​utils/​game_utils.pyButton input parsing, screenshot capture
claude_player/​utils/​memory_reader.pyGame memory/​stats reader
claude_player/​agent/​summary_generator.pyPeriodic game progress summarization
config.jsonRuntime configuration

Available Tools (for the agent during gameplay)

ToolDescription
send_inputsSend button sequences to the emulator
set_gameIdentify the current game
set_current_goalUpdate the gameplay objective
add_to_memoryStore items, NPCs, locations, quests, mechanics, stats
remove_from_memoryRemove a memory entry
update_memory_itemUpdate an existing memory entry
toggle_thinkingToggle extended thinking mode on/​off

How It Works

  1. PyBoy emulator loads the ROM and renders a frame
  2. The frame is captured as a screenshot and sent to Claude
  3. Claude analyzes the screen, reasons about the game state, and calls tools
  4. send_inputs presses buttons on the emulator (A, B, Up, Down, Left, Right, Start, Select)
  5. In turn-based mode, the emulator only advances when the agent acts
  6. The agent maintains structured memory to track long-term game progress
  7. Periodic summaries compress the conversation history to stay within context limits