AI Libraries Dependencies
Relevant source files
The following files were used as context for generating this wiki page:
- README.md
- ROADMAP.md
- license.txt
- .github/workflows/rolling-release.yml (referenced via README.md build process)
- info.nut (referenced via README.md versioning)
Introduction
Trans AI is an automated opponent for OpenTTD designed to manage complex transport logistics across various vehicle types, including buses, trucks, aircraft, and ships. To achieve this functionality, the AI does not operate in isolation but relies on a standardized set of external AI libraries that provide essential utility functions, data structures, and string manipulation capabilities. These dependencies are critical for the AI's ability to navigate the game world, manage lists of towns or industries, and process game data.
The project follows a specific architectural pattern where these libraries must be present in the OpenTTD directory structure for the AI to initialize correctly. Without these specific versions of the Common, List, and String libraries, the AI cannot execute its core logic, such as industry-to-industry freight transport or town-to-town passenger services.
Sources: README.md:1-12, README.md:55-60
Required External Libraries
Trans AI requires three specific AI libraries to be installed in the local environment. These libraries provide the foundational API extensions required for the AI to interact with the OpenTTD engine effectively.
| Library Name | Purpose | Download Source (Reference) |
|---|---|---|
| AI Library - Common | Provides shared utility functions and common AI logic. | AILibCommon-2 |
| AI Library - List | Handles complex list manipulations (e.g., sorting industries by distance). | AILibList-3 |
| AI Library - String | Manages string parsing and formatting for in-game displays and logs. | AILib.String-2 |
Sources: README.md:55-60
Dependency Architecture and Integration
The integration of these libraries follows the standard OpenTTD AI directory structure. The AI expects its dependencies to be located in a peer directory relative to the main AI source code.
Directory Structure
For the AI to recognize and load the dependencies, they must be organized as follows:
Visual representation of the required file system hierarchy for AI and its library dependencies.
Sources: README.md:44-50, README.md:55-60
Dependency Flow and Usage
The AI utilizes these libraries to implement features defined in the project roadmap. For instance, the "List" library is likely utilized in the Cargo Concept strategy to filter and sort available industries to maintain a "many-to-one" destination ratio.
Logic flow showing how external libraries support specific AI features.
Sources: ROADMAP.md:1-50, README.md:55-60
Versioning and Compatibility
Trans AI uses a rolling release model (YYMMDD). For developers, the project uses a specific mechanism to prevent local modifications from being overwritten by official releases.
- Local Versioning: The
info.nutfile in the source uses a version date far in the future to ensure OpenTTD prioritizes the developer's local clone over versions downloaded from 'Bananas' (the content service). - Release Automation: The build process is handled via GitHub Actions, which packages the AI into
.tarfiles for distribution. - Licensing: All dependencies and the AI itself are governed by the GNU General Public License version 2.0.
Sources: README.md:62-70, README.md:74-78, license.txt:1-15
Summary
The "AI Libraries Dependencies" are the backbone of Trans AI's functionality. By leveraging the Common, List, and String libraries, the AI can perform complex tasks such as building buoys for marine routes, managing double-track rail systems, and executing its "Cargo Concept" many-to-one transport strategy. Proper installation of these libraries in the ../ai/library folder is a prerequisite for both players and developers to ensure the AI operates as intended.
Sources: README.md:55-60, ROADMAP.md:15-40