AI-powered Pokemon gameplay agent with headless emulation, REST API, and live dashboard.
Project description
๐ฎ poke-player
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.
- Fork the repo
- Create a feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
๐ License
MIT License โ see LICENSE for details.
๐ Acknowledgments
- Memory addresses from pret/pokered
- Emulator backends: PyBoy, PyGBA
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poke_player-0.2.2-py3-none-any.whl.
File metadata
- Download URL: poke_player-0.2.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0882e1045029db53c34dcead7c5475c69b8d5180550cbd048e28180134f73293
|
|
| MD5 |
48f4666c548765c30696d92802b63d24
|
|
| BLAKE2b-256 |
f87135892403778ce529dec24ea540d73a7623887892712e30cd755b465f35d8
|