TrackmaniaRL
TrackmaniaRL is a Python library for training reinforcement-learning agents on custom Trackmania 2020 maps. It covers map geometry, demonstrations, asynchronous training, checkpoint resume and repeatable evaluation.
The game integration runs on Windows. Training and analysis can also run on Linux. Version 1.2.1 requires Python 3.12 and uses RunSpec 2.0 and checkpoint schema 2.0.
Installation
Install uv, then create a project:
uv tool install "trackmaniarl==1.2.1"
trackmaniarl init my-agent --template trackmania
cd my-agent
uv sync
To install a locally built wheel instead:
uv tool install path\to\trackmaniarl-1.2.1-py3-none-any.whl
To work from this repository, run uv sync --group dev and prefix commands with
uv run.
For a game-free installation check, generate the small SDK starter instead:
trackmaniarl init sdk-check --template starter
cd sdk-check
uv sync
uv run trackmaniarl inspect-config run.yaml
uv run trackmaniarl validate run.yaml
Validation executes trusted component code and a synthetic update. It does not drive the game or establish driving performance. CPU execution is sufficient for this check; live neural inference and training benefit from an NVIDIA GPU with a compatible PyTorch build. See platform and performance guidance.
Neural inference in motion
This excerpt visualizes the best-performing model supplied for this release.
The panel follows geometry, car and context inputs through model stages to action
values and selected controls. The animated summaries are not a causal attribution
of individual neurons. This selected lap uses the map-specific neighbors action
filter; it is neither an unassisted-policy benchmark nor evidence of generalization.
See the model and recording explanation for provenance,
the five-attempt film series and GIF reproduction.
Game setup
You need:
- Trackmania 2020 on Windows
- Openplanet in School Mode
- the TrackmaniaRL Connect / SAC_GetData plugin
- your map open in the editor's validation mode, with the car at the start.
The plugin uses TCP ports 9000 (telemetry) and 9001 (session and map status) on localhost. The setup guide explains plugin installation and controller setup: Trackmania setup.
Check the connection before recording data or training:
uv run trackmaniarl track check
Configure a map
Record both track boundaries from start to finish, then build the geometry file:
uv run trackmaniarl track record-boundary left assets/my-map-left.npy
uv run trackmaniarl track record-boundary right assets/my-map-right.npy
uv run trackmaniarl track build-geometry assets/my-map.geometry.npz `
--left assets/my-map-left.npy `
--right assets/my-map-right.npy `
--map-uid YOUR_MAP_UID `
--map-path maps/my-map.Map.Gbx
Copy the map to maps/, then replace REPLACE_WITH_YOUR_MAP_UID in run.yaml
with the UID printed by track check. See examples/own-map.yaml
for a complete configuration. TrackmaniaRL verifies the open map but does not
select it for you.
Train and resume
Validate the configuration and run a short smoke test before a full training run:
uv run trackmaniarl validate run.yaml
uv run trackmaniarl track check --config run.yaml
uv run trackmaniarl smoke run.yaml --transitions 100
uv run trackmaniarl train run.yaml
The starter project uses a lidar encoder, a dueling IQN policy and 78 discrete control actions. An actor drives while the learner trains from replay.
Demonstrations are optional:
uv run trackmaniarl track record-demo demonstrations --config run.yaml --count 5
uv run trackmaniarl train run.yaml --demo demonstrations
Resume the full training state from a checkpoint:
uv run trackmaniarl resume run.yaml artifacts/RUN/checkpoints/CHECKPOINT.pt
To start a new run with compatible weights, use
train --model-initialization-checkpoint CHECKPOINT.pt. A policy-only checkpoint
does not contain optimizer or replay state and cannot be used for an exact resume.
Evaluate a checkpoint
Run every trial and keep the complete result:
uv run trackmaniarl benchmark run.yaml artifacts/RUN/checkpoints/CHECKPOINT.pt `
--trials 30 --min-finish-rate 1
Add --record recordings/benchmark.mkv to record the Trackmania window. Recording
requires FFmpeg. Use --ffmpeg PATH or --window-title TITLE when the defaults do
not match your system.
Each benchmark writes evaluation.json and an append-only trial timeline. A DNF
still counts as an attempt. Mean and median times cover finished attempts, so report
them together with the finish rate. Telemetry drops are recorded because they can
delay observations and control decisions. --reject-telemetry-skips rejects the
whole evaluation. It never removes individual slow attempts.
More detail: evaluation architecture, recording and troubleshooting.
Documentation
- Configuration
- Model, observations, actions and evaluation
- Neural activation film and repeatable export
- Reward function
- Demonstrations and recovery
- Replay and sequences
- Distributed runtime
- Supported and experimental features
- Troubleshooting
- Migration to schema 2.0
- Python API
PPO and the graph-based recovery models are experimental and are not part of the default Trackmania training path. The project does not currently provide a camera vision pipeline. Configuration files and PyTorch checkpoints can execute Python. only use files you trust.
Development
uv sync --group dev
uv run ruff format --check .
uv run ruff check .
uv run mypy --strict trackmaniarl
uv run pytest
uv build
uv run python scripts/check_distribution.py
TrackmaniaRL is released under the MIT license. It originated from TMRL. attribution is in NOTICE. It is not affiliated with Ubisoft or Nadeo.
Metadata
Release files for TrackmaniaRL 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| trackmaniarl-1.2.1.tar.gz | 29.0 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trackmaniarl-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.5 MB
Release files / trackmaniarl-1.2.1.tar.gz
| Download URL | trackmaniarl-1.2.1.tar.gz |
|---|---|
| Size | 29.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8db5ef970b69648def52a825ee18f230212474984134545b2951098c533a22b5
|
|
BLAKE2b-256 checksum How to use checksums |
5700813d68fae99d833d86d0e8827ab8a620415a01c7a9c641431c95b2977272
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency logRelease files / trackmaniarl-1.2.1-py3-none-any.whl
| Download URL | trackmaniarl-1.2.1-py3-none-any.whl |
|---|---|
| Size | 498.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2879df319fc6e823431234b2066dc22d2e72c18dff4c73085a9afeab557669f2
|
|
BLAKE2b-256 checksum How to use checksums |
6a060bc5880c6def52a073410fd951df9f06560e0ed2826b222251faa38e792f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.
Transparency log