Deterministic, fixed-point, high-throughput Breakout vector environment
Project description
🕹️ Blazing-fast, deterministic Breakout for Reinforcement Learning 🕹️
breakout-turbo-env is a Python library for running many deterministic Breakout games at once. It gives reinforcement-learning researchers and engineers reproducible transitions, policy-ready observations, and a Gymnasium vector-environment API. Install the package, create BreakoutVecEnv, and step every game with one NumPy action batch.
Fixed-point Rust physics owns game state and parallel stepping. Python exposes the Gymnasium lifecycle, rendering, snapshots, and branching helpers.
Install
Requires Python 3.11+.
pip install breakout-turbo-env
The core environment depends only on Gymnasium and NumPy. Install optional tools explicitly when needed:
pip install "breakout-turbo-env[play]" # interactive Pygame player
pip install "breakout-turbo-env[train]" # local PPO training with PyTorch
To work from source, install uv and a Rust toolchain, then run:
git clone https://github.com/tsilva/breakout-turbo-env.git
cd breakout-turbo-env
uv sync --extra dev --extra play --extra train
make develop-release
Import BreakoutVecEnv from the installed environment:
import numpy as np
from breakout_turbo_env import BreakoutVecEnv
env = BreakoutVecEnv(num_envs=4096, num_threads=8)
obs, infos = env.reset()
obs, rewards, terminated, truncated, infos = env.step(
np.zeros(env.num_envs, dtype=np.uint8)
)
done = terminated | truncated
if done.any():
obs, reset_infos = env.reset(options={"reset_mask": done})
env.close()
Commands
uv run --extra play breakout-turbo-env play # open the interactive player
uv run --extra play breakout-turbo-env play --uncapped # visible play without an FPS limit
uv run breakout-turbo-env benchmark # measure the fixed 16-lane policy path
uv run python scripts/compare_stable_retro.py # optional local Stable Retro corner differential
uv run pytest # run Python contract and regression tests
cargo test --lib # run Rust library tests
uv run python train.py jerk # train a deterministic JERK action tape
uv run --extra train python train.py ppo # train a PPO policy
uv run --extra play python play.py jerk # replay the newest JERK policy
uv run --extra play python play.py ppo # replay the newest PPO policy
make release # validate, tag, and publish a release
For player, benchmark, training, and replay options, append --help to the corresponding command.
Notes
- The standard observation batch is grayscale
uint8, CHW, and defaults to(num_envs, 4, 84, 84). The native action contract is0(noop),1(FIRE),2(right), and3(left). Rewards match Stable Retro's Breakout scenario exactly: each reward is the score delta, using7, 7, 4, 4, 1, 1points from the top brick row to the bottom, with no life-loss penalty or board-clear bonus. - The environment is manual-reset only: after a terminal lane, call
reset(options={"reset_mask": mask})before stepping that lane again. Built-in layouts arefull,checker,tunnel, andsparse. - The
fulllayout reproduces Stable Retro'sBreakout-Atari2600-v0Startstate: native 160×210 frames and frame aspect, Stella palette, 18×6 brick wall, 2×4 ball, 16×4 paddle, five lives, FIRE serving, digital-paddle inertia, delayed hardware collision latches, score raster, and scanline clipping. The other layouts deliberately change only the brick mask for experiments. render()returns the native 160×210 RGB frame. Policy observations are resized directly from that native frame into the configured grayscale stack. The interactive player accepts Left/Right or A/D, Space to FIRE, R to reset, P to pause, and Escape to quit. Pass--uncappedfor the fastest visible mode; headless stepping has no frame limiter.- The optional
scripts/compare_stable_retro.pydeveloper probe requires a siblingstable-retro-turbocheckout with the locally installed Breakout ROM. The ROM is never copied into or distributed with this package. - PyPI provides wheels for macOS 11+ on Apple silicon and glibc 2.28+ Linux on x86-64. Other platforms require a source build.
- Training outputs live in
runs/<algorithm>/<timestamp>/. JERK policies usepolicy.json; PPO policies usepolicy.npz. make releaserequires a clean branch synchronized with its upstream. The release workflow builds and audits macOS arm64 and Linux x86_64 wheels before publishing to PyPI.
Architecture
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
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 breakout_turbo_env-0.2.4-cp311-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: breakout_turbo_env-0.2.4-cp311-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 293.4 kB
- Tags: CPython 3.11+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10e4d89d9020f9d8b742b4c8b12df0a4a88ce62748af63a508bd83dc43bad4e4
|
|
| MD5 |
7da7401298dacedbc28c22327006c399
|
|
| BLAKE2b-256 |
20f58f90864eee192ee97a847c00e36df783f669b02994f47de370d351ea9a8a
|
Provenance
The following attestation bundles were made for breakout_turbo_env-0.2.4-cp311-abi3-manylinux_2_28_x86_64.whl:
Publisher:
release.yml on tsilva/breakout-turbo-env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
breakout_turbo_env-0.2.4-cp311-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
10e4d89d9020f9d8b742b4c8b12df0a4a88ce62748af63a508bd83dc43bad4e4 - Sigstore transparency entry: 2199550151
- Sigstore integration time:
-
Permalink:
tsilva/breakout-turbo-env@b9d4c16aff88e2ca7a7281e770f8b91edefd3d4f -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b9d4c16aff88e2ca7a7281e770f8b91edefd3d4f -
Trigger Event:
push
-
Statement type:
File details
Details for the file breakout_turbo_env-0.2.4-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: breakout_turbo_env-0.2.4-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 264.8 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace4f6c7f2ff2ffc1f8e6ec3366fd769de407ef093fc3ed8f2e5e7ff97c5e085
|
|
| MD5 |
89c9542537394a0b7dc776137f945d68
|
|
| BLAKE2b-256 |
909a5786989261feca0c0d3e931282908c47e67a74d25376d125921a872419ef
|
Provenance
The following attestation bundles were made for breakout_turbo_env-0.2.4-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on tsilva/breakout-turbo-env
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
breakout_turbo_env-0.2.4-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
ace4f6c7f2ff2ffc1f8e6ec3366fd769de407ef093fc3ed8f2e5e7ff97c5e085 - Sigstore transparency entry: 2199550183
- Sigstore integration time:
-
Permalink:
tsilva/breakout-turbo-env@b9d4c16aff88e2ca7a7281e770f8b91edefd3d4f -
Branch / Tag:
refs/tags/v0.2.4 - Owner: https://github.com/tsilva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b9d4c16aff88e2ca7a7281e770f8b91edefd3d4f -
Trigger Event:
push
-
Statement type: