How joejaffal/mini_motorways works
Mini Motorways Simulation Lab provides two Unity traffic-construction apps, a shared simulation core and a line-oriented headless host; a separate Python project experiments with reinforcement-learning policies against that host. The main workflow is to reset a city, observe it, issue construction actions and advance simulation, with optional training and evaluation around gameplay. The README documents significant Original/Custom rule differences and training capabilities. Some core simulator and Unity source was not included, so those components and links are based on README statements; edges otherwise follow shown calls or documented interfaces.
Main entry points: train.py Primitive PPO runner · Program.cs JSON host · signal_agent.py Signal policy · environment.py Gym environment
Components 21
Simulation runtime
- Unity apps
simulation - Traffic simulation core
simulation/Assets/Simulation - JSON host
simulation/Headless/Program.cs
Training and policies
- Gym environment
training/environment.py - Goal and signal environments
training/goal_agent.py - Signal policy
training/signal_agent.py - Spatial policies
training/spatial_policy.py - Primitive PPO runner
training/train.py - Goal PPO runner
training/train_goal.py - Parallel host workers
training/parallel.py - Reward shaping
training/rewards.py - Training progress
training/progress.py - Checkpoint migration
training/migration.py - Upgrade rules
training/upgrade_rules.py
Legacy playground
- C++ demo and trainer
legacy/cpp/main.cpp - C++ environment
legacy/cpp/mini_motorways_env.cpp - C++ renderer
legacy/cpp/renderer.cpp
Validation and evidence
- Five-map verification
scripts/verify_five_maps.py - Training readiness check
scripts/check_training_readiness.py - Reference probe
scripts/ReferenceProbe/Program.cs
Other components
- Player or operator
Connections 25
- Player or operator → Unity apps: plays
README.md - Unity apps → Traffic simulation core: uses shared core
README.md - Player or operator → JSON host: sends JSON commands
README.md - JSON host → Traffic simulation core: advances simulation
README.md - Gym environment → JSON host: sends commands
training/environment.py - Gym environment → JSON host: reads observations
README.md - Goal and signal environments → Gym environment: extends environment
training/goal_agent.py - Signal policy → Goal and signal environments: extends goal environment
training/signal_agent.py - Signal policy → Parallel host workers: creates workers
training/signal_agent.py - Primitive PPO runner → Gym environment: creates environment
training/train.py - Primitive PPO runner → Spatial policies: selects policy
training/train.py - Primitive PPO runner → Checkpoint migration: warm starts
training/train.py - Primitive PPO runner → Training progress: reports training
training/train.py - Primitive PPO runner → Parallel host workers: runs workers
training/train.py - Primitive PPO runner → Reward shaping: uses rewards
training/train.py - Goal PPO runner → Goal and signal environments: trains goal policy
training/train_goal.py - Goal PPO runner → Signal policy: supports signal policy
training/train_goal.py - Goal and signal environments → Reward shaping: uses rewards
training/goal_agent.py - Signal policy → Upgrade rules: checks upgrades
training/signal_agent.py - C++ demo and trainer → C++ environment: runs episodes
legacy/cpp/main.cpp - C++ demo and trainer → C++ renderer: renders demo
- C++ renderer → C++ environment: renders state
legacy/cpp/renderer.cpp - Five-map verification → JSON host: tests rule sets
README.md - Training readiness check → JSON host: checks playground
README.md - Reference probe → Traffic simulation core: probes reference