How natebassett/mat099-enhanced-ai-racing works
MAT099 Enhanced AI Racing combines autonomous-agent research in TORCS with a desktop learning and review interface. The primary workflow selects an agent, runs it in a TORCS race, records telemetry and results, then presents saved runs for review and comparison. Training and evaluation scripts support the research workflow; racing-line planning and N-step TD3 learning are distinct technical subsystems. Some connections are documented only at a high level because many GUI and script implementations were not sampled.
Main entry points: torcs_runner.py TORCS runner · main_window.py Main window · n_step_td3_agent.py N-step TD3 agent · learner.py N-step TD3 learner
Components 26
Race execution
- Race history store
src/storage/race_repository.py - TORCS runner
src/runner/torcs_runner.py - TORCS environment wrapper
torcs-wrapper/gym_torcs/gym_torcs.py
Driving agents
- Map-aware agent
src/agents/map_aware_agent.py - Rule-based agent
src/agents/rule_based_agent.py - Dyna-Q agent
src/agents/dyna_q_agent.py - N-step TD3 agent
src/agents/n_step_td3_agent.py - Sensor-only TD3 agent
src/agents/sensor_n_step_td3_agent.py
Learning and planning
- Observation and action contracts
src/n_step_td3/contracts.py - N-step TD3 learner
src/n_step_td3/learner.py - Replay buffer
src/n_step_td3/replay.py - Training environment
src/n_step_td3/environment.py - Racing-line features
src/n_step_td3/racing_line.py - Racing-line planning
src/racing_line/optimizer.py
Desktop experience
- Desktop application
src/gui/app.py - Main window
src/gui/main_window.py - Race worker
src/gui/race_worker.py - Agent education
src/gui/agent_education_model.py - Novice guides
src/gui/novice_education.py - Telemetry review
src/gui/telemetry_model.py - Results and comparison
src/gui/results_view.py
Research workflows
- Training workflows
scripts - Evaluation workflows
scripts - Evaluation analysis
controlled-evaluation/analyse_results.py
Other components
- Learner / researcher
- TORCS simulator
Connections 30
- Learner / researcher → Desktop application: uses
- Desktop application → Main window: loads
src/gui/app.py - Main window → Race worker: starts races
src/gui/main_window.py - Main window → Agent education: presents explanations
src/gui/main_window.py - Agent education → Novice guides: uses guides
src/gui/agent_education_model.py - Main window → Telemetry review: shows telemetry
src/gui/main_window.py - Main window → Results and comparison: shows results
src/gui/main_window.py - Race worker → TORCS runner: runs race
src/gui/race_worker.py - Race worker → Race history store: records results
src/gui/race_worker.py - TORCS runner → TORCS environment wrapper: uses environment
src/runner/torcs_runner.py - TORCS environment wrapper → TORCS simulator: exchanges race data
- TORCS runner → Map-aware agent: requests actions
- TORCS runner → Rule-based agent: requests actions
- TORCS runner → Dyna-Q agent: requests actions
- TORCS runner → N-step TD3 agent: requests actions
- TORCS runner → Sensor-only TD3 agent: requests actions
- Map-aware agent → Racing-line planning: uses track line
src/agents/map_aware_agent.py - N-step TD3 agent → Observation and action contracts: builds observations
src/agents/n_step_td3_agent.py - N-step TD3 agent → N-step TD3 learner: loads policy
src/agents/n_step_td3_agent.py - N-step TD3 agent → Racing-line features: uses line context
src/agents/n_step_td3_agent.py - Sensor-only TD3 agent → N-step TD3 agent: specializes
src/agents/sensor_n_step_td3_agent.py - Training environment → Observation and action contracts: builds observations
src/n_step_td3/environment.py - Training environment → TORCS runner: uses race runner
src/n_step_td3/environment.py - N-step TD3 learner → Observation and action contracts: validates contracts
src/n_step_td3/learner.py - N-step TD3 learner → Replay buffer: samples experience
src/n_step_td3/learner.py - Training workflows → N-step TD3 learner: trains policies
- Training workflows → Training environment: collects experience
- Evaluation workflows → TORCS runner: evaluates agents
- Evaluation analysis → Evaluation workflows: analyzes outputs
- Racing-line features → Racing-line planning: reads line data