Overall System Architecture
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- ROADMAP.md
- license.txt
- info.nut (Referenced via README.md logic)
- .github/workflows/rolling-release.yml (Referenced via README.md logic)
Trans AI is an automated artificial intelligence designed for the OpenTTD simulation engine. Its primary purpose is to manage a transport company by autonomously moving cargo, passengers, and mail between towns and industries using a variety of vehicle types including buses, trucks, trams, aircraft, ships, and trains.
The architecture is built upon the OpenTTD NoAI framework, utilizing specific external libraries for common tasks, list management, and string manipulation. It employs a "Cargo Concept" strategy, prioritizing many-to-one transport flows to streamline logistics and maximize efficiency within the game environment.
Sources: README.md:3-9, README.md:14-17
Core Transportation Modules
The system is partitioned into specialized modules based on the route type and vehicle category. Each module handles pathfinding, station construction, and vehicle management specific to its domain.
Air and Marine Routes
The Air Route module focuses on passenger transport between towns using airports and aircraft (including helicopters). The Marine Route module utilizes ships for both town-to-town (passengers/mail) and industry-to-industry/town (freight) transport, incorporating buoy placement for navigation.
Road and Rail Routes
The Road and Tram modules utilize buses for passengers and trucks for freight. The Rail Route module is specialized for raw cargo transport between industries, supporting double-track configurations where buildable and falling back to single-track operations when necessary.
The diagram above illustrates how the Trans AI core interfaces with specific transportation modules to interact with game world entities like Towns and Industries.
Sources: ROADMAP.md:4-28
Strategic Logic and Features
Trans AI implements high-level strategic features that govern its economic behavior and infrastructure management.
| Feature | Description | Status |
|---|---|---|
| Cargo Concept | Many-to-one transport strategy where one industry serves as a primary destination. | Partial (Road/Marine Reworking) |
| Merger Management | Ability to accept merger offers from competitor companies. | Implemented |
| Infrastructure Maintenance | Adjusts behavior (primarily for Air) based on game-wide maintenance settings. | Implemented |
| Double Track Rail | Prefers double-track layouts; supports fallback to single track with 2-train limit. | Implemented |
Sources: ROADMAP.md:32-52
Component Dependencies and Integration
Trans AI is not a standalone codebase; it relies on the OpenTTD NoAI API and several mandatory external libraries. These libraries must be present in the ai/library directory of the OpenTTD installation.
- AI Library - Common: Basic utility functions.
- AI Library - List: Advanced list manipulation for filtering stations, industries, and vehicles.
- AI Library - String: String processing capabilities.
Sources: README.md:44-48
Build and Versioning System
The architecture includes a CI/CD pipeline for automated releases, moving away from manual scripts to a GitHub Actions-based workflow.
This sequence shows the automated transition from source code to a deployable OpenTTD AI package.
Sources: README.md:52-64
Summary
The Trans AI architecture is a modular, event-driven system designed to operate within the OpenTTD NoAI framework. By separating transportation logic into specific vehicle modules (Air, Road, Marine, Rail) and implementing high-level strategic concepts like "Cargo Concept" and automated infrastructure maintenance, the AI provides a comprehensive opponent capable of managing complex transport networks. The integration of automated rolling releases ensures that development builds and stable versions are consistently available to players and developers alike.
Sources: README.md:3-10, ROADMAP.md:32-35