Road Route Management
Relevant source files
The following files were used as context for generating this wiki page:
Road Route Management is a core subsystem of the Trans AI project designed to handle the transportation of passengers and freight using road-based infrastructure. It facilitates connections between towns and industries by deploying a variety of road vehicles, including buses, trucks, and trams. This system is integral to the AI's goal of establishing efficient transport networks within the OpenTTD environment while adhering to specific logistics strategies like the Cargo Concept.
The system encompasses two primary track types: standard Road Tracks and specialized Tram Tracks. While road tracks support a broad range of buses and trucks, tram tracks focus on tram-buses and tram-trucks, often utilized for specific cargo types such as mail. The implementation is currently undergoing refinement to better support advanced logistics models and the many-to-one cargo destination strategy.
Sources: README.md:3-8, ROADMAP.md:8-16
Infrastructure and Vehicle Types
The Road Route Management system distinguishes between standard road vehicles and tram-based vehicles. Each type serves specific logistics purposes ranging from urban passenger transport to industrial freight hauling.
Road Tracks
Standard road tracks are the primary infrastructure for:
- Buses: Used for transporting passengers between different towns.
- Trucks: Used for transporting freight cargoes between industries or from industries to towns.
Tram Tracks
Tram tracks provide an alternative road-based infrastructure with specific vehicle requirements:
- Tram-buses: Utilized for inter-town passenger transport.
- Tram-trucks: Used for industrial freight and mail. The system specifically notes that mail trucks are the most commonly available vehicle type for this category.
Sources: ROADMAP.md:9-16
Cargo Strategy and Logic
The AI employs a specific strategy known as the "Cargo Concept" for its road routes. This strategy prioritizes a many-to-one transport model where multiple sources of cargo are directed toward a single industry destination type where possible.
Logistics Implementation Status
The implementation of the Cargo Concept for road routes is currently in progress. As indicated in the project roadmap, the feature is partially complete and requires further rework to reach full operational capability.
| Feature | Type | Status |
|---|---|---|
| Passenger Transport | Town-to-Town | Completed |
| Freight Cargo | Industry-to-Industry | Completed |
| Cargo Concept (Road) | Many-to-One Strategy | 50% (In Progress) |
| Tram Mail Service | Freight | Completed |
Sources: ROADMAP.md:9-16, ROADMAP.md:28-32
Operational Workflow
The following diagram illustrates the decision-making process for establishing a road route based on the available infrastructure and cargo requirements.
This flowchart represents the high-level logic for route creation, from source identification to the application of the Cargo Concept.
Sources: README.md:3-8, ROADMAP.md:9-16, ROADMAP.md:28-32
Technical Integration
Road Route Management relies on external AI libraries to handle data structures and string manipulations necessary for pathfinding and vehicle management.
Dependencies
To function correctly, the management system requires the following libraries in the AI directory:
- AI Library - Common: Basic AI utility functions.
- AI Library - List: Management of vehicle and station lists.
- AI Library - String: Handling of town and industry names.
Sources: README.md:43-47
Versioning and Development
The system follows a rolling release model where the version is defined by the commit date (YYMMDD). For local development, the version in info.nut is set to a future date to ensure the development version takes precedence over official releases.
This sequence illustrates how the AI ensures the local development version of the road management code is prioritized by the game engine.
Sources: README.md:49-57, info.nut
Conclusion
Road Route Management in Trans AI provides the foundational logic for bus and truck operations. By balancing standard road infrastructure with tram tracks and moving toward a consolidated "Cargo Concept" destination strategy, the system aims to automate complex logistics. Future updates focus on completing the many-to-one cargo rework and improving efficiency in freight distribution.
Sources: ROADMAP.md:28-34, README.md:3-10