A work-in-progress transit simulation system built with Godot
This project is developed as part of academic research and now provides a full simulation and RL training environment.
Implemented:
- Core Systems: Network topology modeling and graph-based pathfinding
- Performance: Multi-threaded A* implementation for real-time simulation
- Architecture: Hybrid C#/GDScript architecture with custom dependency injection
- Vehicle Modeling: Regular and articulated buses with realistic specifications and lane constraints
- Schedule Management: Lines, trips (kurs) and brigade (brygada) timetables driving daily operations
- Fleet Management: Passenger demand, terminals/depots and vehicle deployment
- AI Integration: RL environment with TCP training bridge and in-game ONNX inference
Academic Project: Part of a Master's Thesis at Cracow University of Technology focusing on usage of AI in the transportation systems in peak, rush hours.
- Engine: Godot 4.6
- Language: C# (.NET 8.0) with GDScript for UI components
- Architecture: Dependency injection with custom DI container
- Pathfinding: Custom A* implementation with graph-based routing
- Godot 4.6 or later
- .NET 8.0 SDK
-
Clone the repository:
git clone github.com/domiotek/peak-transit cd peak-transit -
Open the project in Godot:
- Launch Godot Engine
- Click "Import" and select the
project.godotfile - Wait for the project to import and compile
-
Run the project from Godot or press F5
- WASD or Arrow Keys: Move camera viewport
- F12: Access debug interface and development tools
- Speed Controls:
space: pause/resume simulation1-4: control simulation speed
The project uses a custom dependency injection container that bridges C# and GDScript:
DIContainer.cs: Main DI container for C# servicesGDInjector.gd: GDScript interface for dependency injectionCSInjector.cs: C# service locator
- NetGraph: Graph representation of the transit network
- NetNode: Intersection points and stops
- NetSegment: Road/track segments connecting nodes
- NetLane: Individual lanes within segments
- Multi-threaded pathfinding using A* algorithm
- Concurrent request queue for handling multiple path calculations
- Optimized for real-time simulation performance
The game includes comprehensive debugging tools:
- Visual overlay for camera bounds and network elements
- Debug toggles for various system components
- Intersection analysis and visualization
- Auto-breakpoints accessible via UI for various elements on next
processcall
Access debug tools by pressing the F12 key during gameplay.
The full transit network with terminals, depots and buildings across the map:
Real-time traffic with buses, cars, lane markings and traffic signs at an intersection:
Per-vehicle information with line, route and trip details, brigade assignment and passenger load:
RL training/inference mode showing the brigade fleet panel and the live reward breakdown:
The project serves as a training environment for Reinforcement Learning research in transit optimization. Agents (PPO, Maskable PPO, DQN) are trained against the simulation over a TCP bridge and exported to ONNX for in-game inference.
Research Goals:
- RL Environment: Game acts as a training environment for AI dispatcher agents
- Transit Optimization: AI-driven fleet management and scheduling decisions
- Real-time Decision Making: Agent responses to dynamic network conditions
Technical Investigation Areas:
- Efficient pathfinding algorithms for dynamic transportation networks
- Real-time simulation performance for RL training environments
- Game engine integration with machine learning frameworks
- State representation and action spaces (with action masking) for transit management
- Reward function design for optimal transit network performance



