Introduction to Trans AI
Relevant source files
The following files were used as context for generating this wiki page:
Trans AI is a custom artificial intelligence designed for OpenTTD (Open Transport Tycoon Deluxe). Its primary objective is to manage the transportation of various cargo types (passengers, mail, and freight) across the game world using a diverse range of transport modes, including road vehicles, aircraft, ships, and trains.
Sources: README.md:3-6, ROADMAP.md:5-25
The AI is built using the NoAI framework introduced in OpenTTD version 0.7, which allows developers to implement custom logic for in-game opponents. Trans AI specifically focuses on a "Many-to-one" cargo strategy, aiming to consolidate cargo deliveries to single destination industries where feasible.
Sources: README.md:9-11, ROADMAP.md:34-37
Core Transport Logistics
Trans AI implements logic for multiple transport layers, each specialized for specific cargo and distance profiles.
Air and Marine Routes
The AI utilizes aircraft to transport passengers between towns, including helicopters for specialized routes such as Town-to-Oil Rig connections. Marine transport is used for passengers, mail, and freight, utilizing buoys to facilitate proper pathfinding across water bodies.
Sources: ROADMAP.md:5-9, ROADMAP.md:17-20
Road and Rail Infrastructure
Road services utilize buses for passenger transport and trucks for freight between industries and towns. Rail services are currently focused on raw cargo transport between industries, with support for double-track configurations to optimize throughput.
Sources: ROADMAP.md:10-16, ROADMAP.md:21-30
The following diagram illustrates the relationship between transport modes and their primary cargo types:
Sources: ROADMAP.md:5-30
Technical Architecture & Dependencies
Trans AI relies on external Squirrel libraries to handle common data structures and string manipulations. These must be present in the OpenTTD ai/library directory for the AI to function.
| Dependency | Purpose | Source |
|---|---|---|
| AILib Common | General helper functions and utilities | README.md:46 |
| AILib List | Advanced list manipulation for game objects | README.md:47 |
| AILib String | String parsing and formatting utilities | README.md:48 |
Development Versioning
The project employs a rolling release model. The versioning is tied to the commit date in YYMMDD format. In local development environments, the info.nut file typically sets a future date to prevent the game from overriding local code with versions from the official content service ('Bananas').
Sources: README.md:50-57, info.nut
Automation and Deployment
The project uses GitHub Actions to automate the build and release process. This pipeline ensures that every push results in a packaged .tar file ready for distribution.
Advanced Features and Roadmap
Beyond basic transportation, Trans AI includes several complex management features:
- Cargo Concept: Implementation of the many-to-one delivery model to streamline logistics networks.
- Merger Acceptance: The AI can accept merger offers from competitor companies, though it is still developing logic to turn acquired negative-income companies into profitable ones.
- Infrastructure Maintenance: Automatic detection and adjustment of behavior based on game settings regarding infrastructure costs, specifically affecting air route planning.
- CargoDist Support: Planned support for the CargoDist game mode using official OpenTTD APIs.
Sources: ROADMAP.md:34-52
Feature Implementation Status
| Feature | Mode | Status |
|---|---|---|
| Town-to-Town Aircraft | Air | Implemented |
| Town-to-Oil Rig Chopper | Air | Planned |
| Double Track Rail | Rail | Implemented |
| Industry-to-Town Rail | Rail | Planned |
| Infrastructure Maintenance | General | Implemented |
| CargoDist Support | General | Planned |
Sources: ROADMAP.md:5-52
Licensing and Contributions
Trans AI is open-source software distributed under the GNU General Public License version 2.0. All contributions to the repository are subject to this license, ensuring the code remains free and modifiable by the community.
Sources: README.md:64-67, license.txt:1-15