ChromaticRL is a reinforcement learning project designed for an agent on a Mac to control a custom Game Boy ROM running on a real ModRetro Chromatic. It is building a Gymnasium interface to send actions to the handheld and receive physical state and reward.
Target interaction:
flowchart LR
A["RL agent on Mac"] -->|action| B["Physical Chromatic"]
B --> C["GridWorld ROM"]
C -->|state + reward| A
Physical state readback is still in progress.
- Gymnasium GridWorld
- Tabular Q-learning
- Matching GBDK ROM
- Python-to-ROM parity testing
- Physical ROM execution
- Mac-controlled physical button input
- Structured telemetry protocol, tested in emulation
- Physical state readback in progress
The Q-learning agent learned the optimal 8-step route with a return of +0.92. All 80 reachable state/action cases match between the Python environment and ROM. GridWorld boot, controls, collisions, reset, and the optimal route have been validated on the physical Chromatic.
Requires Python 3.11 or newer.
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e '.[dev]'
python -m pytest
python examples/train_q_learning.pyThe random-policy example is available with python examples/random_agent.py.
Install GBDK 4.5.0 and put its bin directory on your PATH. The ROM tests also require the optional Python dependencies:
python -m pip install -e '.[dev,rom]'
export GBDK_LCC="$(command -v lcc)"
python rom/build.py
python -m pytest tests rom/test_parity.py rom/test_telemetry.pyThe build writes build/rom/gridworld.gb and matching symbols. The PyBoy tests compare ROM transitions and telemetry packets with the Python environment. Serial transfer through a physical link adapter has not yet been tested.
The software environment, ROM, emulator parity, physical execution, and Mac-controlled input path are working. The next milestone is structured physical state readback, followed by a Gymnasium hardware wrapper.
Licensed under the MIT License.