Seed
Loading episodes…
SimForge Gym is a Gymnasium-compatible environment for driving policies, installed as the simforge-rl package. Episodes run in the SimForge runtime on maps of real places, against traffic that reacts to what the policy does.
What you get
- The Gymnasium API. reset, step and a seed; your training code does not need to know it is driving a simulator.
- Deterministic seeds. The same seed and the same actions give byte-identical observations.
- Reactive traffic. Other road users yield, avoid and obey signals, so a hard brake or a late merge has consequences.
- A PPO baseline. Trains in 38 minutes on one CPU with no GPU; a same-seed rerun matched its returns byte for byte.
- Sensor-only mode. The policy gets rendered camera passes and the clock, and no engine state.
Quickstart
State observations need no GPU. Sign in, install the package, the runtime and a map:
simforge login
pip install 'simforge-rl[ppo]'
simforge runtime install --accept-license
simforge maps pull richmond-field-station@v9 --accept-licenseThen step eight episodes at once from Python:
from simforge_rl import RuntimeSessions, ScenarioSet, make_vector_env
tasks = ScenarioSet.bundled("richmond-field-station")
with RuntimeSessions(tasks, "--no-sensors", workdir="work") as sessions:
envs = make_vector_env(tasks, sessions.transports(), num_envs=8)
obs, info = envs.reset(seed=0)
obs, reward, terminated, truncated, info = envs.step(envs.action_space.sample())Actions, observations, rewards, task sets and camera mode are in the RL reference.
The PPO baseline
PPO on the 24 Richmond Field Station tasks, 1.23 M environment steps on one CPU. Mean held-out return rose from 0.79 to 2.74, against 0.71 for the scenarios' own authored driving. It wins on 12 of the 24 tasks and still crashes on some:
| Task | Initial | Trained | Authored |
|---|---|---|---|
| Cyclist crossing the path | 8.43 | 20.25 | -8.17 |
| Oncoming car overtakes into the lane | 11.27 | 15.41 | 5.31 |
| Unprotected left turn, opposing traffic | 9.57 | 10.95 | 2.89 |
| Disabled vehicle ahead | -8.18 | -8.18 | 0.55 |
| Lead vehicle brakes hard | -7.58 | -7.73 | 1.88 |
| Child steps out between parked cars | -7.06 | -7.08 | 2.40 |
Read the docs
Copies a command that installs the SimForge CLI and runs this page's example.