Cargo Destination Prioritization
Relevant source files
The following files were used as context for generating this wiki page:
Cargo Destination Prioritization in Trans AI is governed by the "Cargo Concept," a strategy designed to streamline logistics by consolidating transport destinations. The system prioritizes efficiency by attempting to use a single industry type as the primary destination for specific cargo types whenever possible. This approach is intended to simplify route management across various transport modes, including road, marine, and rail.
Sources: README.md:5-7, ROADMAP.md:33-35
Core Strategy: The Cargo Concept
The primary logic behind cargo prioritization is the "Many-to-one" concept. Trans AI evaluates available industries and attempts to route cargo from multiple sources to a singular destination industry. This minimizes the complexity of the transport network and focuses resources on high-volume corridors.
Implementation Status by Route Type
The prioritization logic is implemented with varying degrees of maturity across different transport sectors:
| Route Type | implementation Status | Description |
|---|---|---|
| Air | Basic | Primarily focused on passenger transport between towns. |
| Road | 50% (Rework needed) | Used for passengers (town-to-town) and freight (industry-to-industry). |
| Marine | 50% (Rework needed) | Transports passengers, mail, and freight using buoys for routing. |
| Rail | Planned / Partial | Currently focuses on raw cargoes between industries. |
Sources: ROADMAP.md:4-31, ROADMAP.md:36-39
Destination Selection Logic
Trans AI utilizes specific rules to determine where cargo should be delivered based on the vehicle type and the nature of the cargo (passengers vs. freight).
Industry and Town Prioritization
The AI distinguishes between town-based cargo (passengers/mail) and industrial cargo (raw materials/freight).
- Town Destinations: Prioritized for aircraft, buses, trams, and ships.
- Industry Destinations: Prioritized for trucks, trams, ships, and trains.
- Specialized Destinations: Specific logic exists for transporting passengers from towns to oil rigs via chopper services.
Sources: ROADMAP.md:4-31, README.md:5-7
Logic Flow for Destination Assignment
The following diagram illustrates how the AI selects a destination based on the cargo type and available infrastructure.
The diagram shows the decision path from identifying a cargo source to establishing a route based on the "Many-to-one" concept.
Sources: ROADMAP.md:5-15, ROADMAP.md:33-35
Future Prioritization Features
The project roadmap indicates a shift toward more complex prioritization through the integration of native OpenTTD features and improved logic.
CargoDist Support
Trans AI is planned to support the CargoDist game mode. This will involve utilizing the OpenTTD API to handle more complex, multi-destination cargo distributions where the game engine determines cargo destinations rather than the AI's internal "Many-to-one" logic.
Rail Route Expansion
Future updates aim to prioritize rail for:
- Town-affected cargoes (secondary or tertiary chains).
- Passenger transport between towns.
- Double track utilization to increase throughput to priority destinations.
Sources: ROADMAP.md:24-31, ROADMAP.md:45-46
Technical Environment and Constraints
The prioritization logic is constrained by the AI's library dependencies and the versioning environment.
- Dependencies: The AI relies on
AILibCommon,AILibList, andAILib.Stringto process lists of industries and towns for destination selection. - Version Priority: The AI uses a rolling release versioning (
YYMMDD). In development environments, theinfo.nutfile sets a future date to ensure the local prioritization logic is tested over downloaded versions.
Sources: README.md:41-45, README.md:47-52
Component Relationship
This diagram represents the relationship between the main AI core and the libraries used to execute destination prioritization.
Sources: README.md:41-45, info.nut
Conclusion
Cargo Destination Prioritization in Trans AI is currently centered on the "Many-to-one" Cargo Concept, aiming to consolidate deliveries to single industry types. While aircraft and basic freight routes are functional, the system is undergoing rework for road and marine routes and anticipates significant changes with the future implementation of CargoDist support.
Sources: ROADMAP.md:33-46, README.md:5-9