tickgym¶
pip install tickgym
Drive Trackmania 2020 physics from Python, for training agents on exact, restorable simulation.
Three objects do everything:
A
Clienttalks to TICK on this machine and opens a map as aSession.A
Sessionis one map, loaded and ready. Eachconnecton it opens a gym; open several for several gyms side by side.A
Gymis one car on that map. Youresetit,stepit a few ticks at a time with inputs,snapshotandrestoreit, and read a typedTelemetryafter every call.
from tickgym import Client, TelemetryGroup
session = Client().open_map(r"C:\Maps\Example.Map.Gbx")
with session.connect(TelemetryGroup.RACE | TelemetryGroup.VEHICLE) as gym:
t = gym.reset(seed=1)
while not t.finished:
t = gym.step(3, steer=40, accelerate=True)
print(t.race.race_time_ms, t.vehicle.position)
The same seed and inputs always give the same race, and the physics is the game’s own.
API reference
Requirements¶
TICK 3.0 installed and run once with the game, so it knows the game’s folders.
Python 3.11 or newer and NumPy.