Skip to content

KevRojo/poke-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ 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

About

๐ŸŽฎ poke-player 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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors