AI Decision Making Model
Relevant source files
The following files were used as context for generating this wiki page:
The AI Decision Making Model within Trans AI governs how the agent interacts with the OpenTTD environment to establish transport networks and manage corporate growth. It focuses on multi-modal logistics, utilizing buses, trucks, trams, aircraft, ships, and trains to move passengers and freight between towns and industries. The model's primary strategic objective is the implementation of the "Cargo Concept," which prioritizes high-efficiency transport to centralized industry destinations.
Sources: README.md:3-8, ROADMAP.md:3-33
Core Strategy: The Cargo Concept
The central decision-making logic of Trans AI is guided by the Cargo Concept, a many-to-one transport strategy. The AI attempts to identify and use only one type of industry as a cargo destination where possible. This simplifies logistics chains and mimics advanced player strategies in OpenTTD.
Sources: README.md:7-8, ROADMAP.md:34-37
Logistics Priority Table
| Transport Mode | Target Cargo | Destination Logic |
|---|---|---|
| Air | Passengers | Town-to-town; specific town-to-oil rig logic for choppers. |
| Road | Passengers / Freight | Town-to-town (bus); Industry-to-industry/town (truck). |
| Marine | Passengers / Freight | Town-to-town; Industry-to-industry/town using buoys. |
| Rail | Raw Cargoes | Industry-to-industry; Double track preferred over single track. |
Sources: ROADMAP.md:4-31
Route Selection and Infrastructure
The AI evaluates different route types based on the available vehicle types and geographic constraints. Each route type follows a specific set of rules for infrastructure deployment and maintenance.
Modal Logic Flow
The following diagram illustrates the decision flow when the AI evaluates a potential transport route.
The AI prioritizes double track for rail when space and budget allow, falling back to a two-train single-track limit otherwise.
Sources: ROADMAP.md:3-32
External Logic and State Management
Beyond transport, the AI manages corporate decisions including infrastructure maintenance, competitor interactions, and game mode compatibility.
Maintenance and Competitors
- Infrastructure Maintenance: The AI detects if maintenance costs are enabled and adjusts its construction logic, particularly for expensive air routes.
- Merger Management: The AI can accept merger offers from other companies.
- Profit Recovery: A future module aims to turn negative-income acquired companies into profitable ones to prevent bankruptcy.
Sources: ROADMAP.md:41-47
Versioning and Environment Sensitivity
The AI adapts its behavior and identification based on its build environment. It uses a rolling release model (YYMMDD) to ensure players always have the latest logic.
Trans AI relies on specific external libraries (Common, List, and String) to execute its decision-making routines.
Sources: README.md:44-55, info.nut
Technical Requirements
The AI's decision-making is dependent on the following library versions:
- AI Library - Common: Version 2
- AI Library - List: Version 3
- AI Library - String: Version 2
Sources: README.md:45-48
The AI Decision Making Model in Trans AI is a evolving system designed to automate complex logistics in OpenTTD. By adhering to the "Cargo Concept" and managing multi-modal transport routes along with corporate maintenance, the AI provides a competitive and structured opponent capable of handling various cargo types and infrastructure challenges.