Skip to content

Repository files navigation

Peak Transit

A work-in-progress transit simulation system built with Godot

🚧 Development Status

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.

🛠️ Technology Stack

  • 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

🚀 Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone github.com/domiotek/peak-transit
    cd peak-transit
  2. Open the project in Godot:

    • Launch Godot Engine
    • Click "Import" and select the project.godot file
    • Wait for the project to import and compile
  3. Run the project from Godot or press F5

🎮 Controls

  • WASD or Arrow Keys: Move camera viewport
  • F12: Access debug interface and development tools
  • Speed Controls:
    • space: pause/resume simulation
    • 1-4: control simulation speed

🔧 Architecture

Dependency Injection

The project uses a custom dependency injection container that bridges C# and GDScript:

  • DIContainer.cs: Main DI container for C# services
  • GDInjector.gd: GDScript interface for dependency injection
  • CSInjector.cs: C# service locator

Network System

  • NetGraph: Graph representation of the transit network
  • NetNode: Intersection points and stops
  • NetSegment: Road/track segments connecting nodes
  • NetLane: Individual lanes within segments

Pathfinding

  • Multi-threaded pathfinding using A* algorithm
  • Concurrent request queue for handling multiple path calculations
  • Optimized for real-time simulation performance

🐛 Debugging

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 process call

Access debug tools by pressing the F12 key during gameplay.

📷 Screenshots

City Overview

The full transit network with terminals, depots and buildings across the map:

City Overview

Simulation & Traffic

Real-time traffic with buses, cars, lane markings and traffic signs at an intersection:

Simulation

Vehicle & Trip Management

Per-vehicle information with line, route and trip details, brigade assignment and passenger load:

Vehicle Management

Reinforcement Learning Environment

RL training/inference mode showing the brigade fleet panel and the live reward breakdown:

RL Environment

📚 Research Focus

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

About

A reinforcement learning testbed for transit optimization built with Godot 4.4 and C#. Master's thesis project exploring AI-driven fleet management and scheduling in real-time transportation networks.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages