Skip to content

About

Reinforcement learning on the ModRetro Chromatic, with a Gymnasium GridWorld, tabular Q-learning, and a matching Game Boy ROM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ChromaticRL

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.

Demo

How It Works

Target interaction:

flowchart LR
    A["RL agent on Mac"] -->|action| B["Physical Chromatic"]
    B --> C["GridWorld ROM"]
    C -->|state + reward| A
Loading

Physical state readback is still in progress.

Current 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

Results

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.

Run Locally

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.py

The random-policy example is available with python examples/random_agent.py.

ROM Development

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.py

The 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.

Status

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.

About

Reinforcement learning on the ModRetro Chromatic, with a Gymnasium GridWorld, tabular Q-learning, and a matching Game Boy ROM.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages