Skip to main content

AI-powered Pokemon gameplay agent with headless emulation, REST API, and live dashboard.

Project description

๐ŸŽฎ poke-player

Python License: MIT Code style: black

AI-powered Pokรฉmon gameplay agent with headless emulation, REST API, and live dashboard.

Control Pokรฉmon games (Game Boy / GBA) programmatically via HTTP API, read live game state from emulator RAM, and watch the AI play through a real-time web dashboard.


โœจ Features

  • ๐Ÿ•น๏ธ Headless Emulation โ€” PyBoy (GB/GBC) and PyGBA (GBA) backends
  • ๐Ÿง  Live Memory Reading โ€” Extract player data, party Pokรฉmon, battle state, bag items, map position, and story flags directly from RAM
  • ๐ŸŒ REST API + WebSocket โ€” Control the emulator via HTTP and receive real-time state updates
  • ๐Ÿ“Š Live Dashboard โ€” Beautiful cyberpunk-themed web UI with game screen, team stats, battle info, and AI action log
  • ๐Ÿ” A Pathfinding* โ€” Grid-based navigation with collision map support
  • ๐Ÿ’พ Save States โ€” Named save/load slots for quick experimentation
  • ๐Ÿ“ธ Screenshots โ€” Capture PNG frames on demand

๐Ÿš€ Quick Start

Installation

# Basic install (PyBoy for GB/GBC)
pip install poke-player

# With GBA support
pip install "poke-player[pyboy,pygba]"

# With dashboard
pip install "poke-player[dashboard]"

# Everything
pip install "poke-player[all]"

Start the Server

poke-player serve --rom path/to/red.gb --port 8765

View the Dashboard

Open http://localhost:8765/dashboard in your browser.


๐Ÿ› ๏ธ CLI Usage

# Start server
poke-player serve --rom red.gb --data-dir ~/.poke-player

# Show ROM info
poke-player info --rom red.gb

# Get current game state
poke-player state

# Press buttons
poke-player action a
poke-player action "up,up,a,b"

# Save / load state
poke-player save before_gym
poke-player load before_gym
poke-player saves

# Screenshot
poke-player screenshot --out frame.png

# Minimap
poke-player minimap

# Stop server
poke-player stop

๐Ÿ”Œ API Endpoints

Method Endpoint Description
GET /health Server health check
GET /state Full game state JSON
GET /state/summary Human-readable state summary
POST /action Press buttons ({"actions": ["a"]})
POST /save Save state ({"name": "slot1"})
POST /load Load state ({"name": "slot1"})
GET /saves List save slots
GET /screenshot PNG screenshot (base64 or raw)
GET /minimap Explored area minimap
GET /info ROM metadata
WS /ws WebSocket for live updates

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     HTTP/WS      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Dashboard โ”‚ โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โ”‚  FastAPI     โ”‚ โ—„โ”€โ”€โ–บโ”‚   PyBoy     โ”‚
โ”‚  (Browser)  โ”‚                  โ”‚   Server     โ”‚     โ”‚  / PyGBA    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ–ผ
                              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                              โ”‚  Memory Reader   โ”‚
                              โ”‚  (Red/FireRed)   โ”‚
                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿงช Development

# Clone
git clone https://github.com/KevRojo/poke-player.git
cd poke-player

# Install in editable mode
pip install -e ".[all,dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=poke_player

# Lint
ruff check .

๐Ÿ—บ๏ธ Supported Games

Game Platform Status Reader
Pokรฉmon Red/Blue Game Boy โœ… Complete memory/red.py
Pokรฉmon FireRed GBA ๐Ÿšง Stub memory/firered.py

๐Ÿ“ Project Structure

poke_player/
โ”œโ”€โ”€ cli.py           # Command-line interface
โ”œโ”€โ”€ server.py        # FastAPI HTTP/WebSocket server
โ”œโ”€โ”€ emulator.py      # Emulator wrapper (PyBoy / PyGBA)
โ”œโ”€โ”€ pathfinding.py   # A* tile navigation
โ”œโ”€โ”€ memory/
โ”‚   โ”œโ”€โ”€ reader.py    # Abstract memory reader
โ”‚   โ”œโ”€โ”€ red.py       # Pokรฉmon Red/Blue reader
โ”‚   โ””โ”€โ”€ firered.py   # FireRed reader (Phase 2)
โ”œโ”€โ”€ state/
โ”‚   โ””โ”€โ”€ builder.py   # Game state assembly
โ””โ”€โ”€ dashboard/
    โ””โ”€โ”€ static/      # Web dashboard (HTML/CSS/JS)

๐Ÿค Contributing

Contributions welcome! Please open an issue or PR.

  1. Fork the repo
  2. Create a feature branch (git checkout -b feature/amazing)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing)
  5. Open a Pull Request

๐Ÿ“œ License

MIT License โ€” see LICENSE for details.


๐Ÿ™ Acknowledgments


Made with ๐Ÿ’œ by KevRojo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

poke_player-0.2.1-py3-none-any.whl (73.6 kB view details)

Uploaded Python 3

File details

Details for the file poke_player-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: poke_player-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 73.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for poke_player-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a5cc8002005148d54390006897c115d528a9bd71d004ed2070f4340a0493bd2
MD5 65f5ec464cad7d6fa4c838c0f92fe776
BLAKE2b-256 71b7e5df5490eb1cf3eb34e2573a1b6a1b3a8ec52cc7b2c729536c513f588ba0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page