Local Development Environment Setup
Relevant source files
The following files were used as context for generating this wiki page:
This guide provides technical instructions for setting up a local development environment for Trans AI, an artificial intelligence designed for OpenTTD. Setting up the environment correctly ensures that local changes take precedence over installed versions and that all necessary libraries are available for the AI's logic modules.
The development environment is centered around the OpenTTD ai directory, where the source code is cloned and external AI libraries are managed. This setup allows for rapid iteration on features such as vehicle routing (Air, Road, Marine, Rail) and advanced strategies like the "Cargo Concept."
Sources: README.md:3-8, ROADMAP.md:1-5
Repository Integration
To develop for Trans AI, the repository must be cloned directly into specific platform-dependent paths within the OpenTTD directory structure. This allows the game engine to recognize the AI source files during startup.
OS-Specific Directory Paths
| Operating System | Target AI Directory Path |
|---|---|
| Linux | $(HOME)/.openttd/ai |
| macOS | $(HOME)/Documents/OpenTTD/ai |
| Windows | C:\Users\<username>\Documents\OpenTTD\ai |
Sources: README.md:34-37
Versioning and Priority Logic
In a local development setup, the version number in the info.nut file is intentionally set to a date far in the future. This is a strategic configuration to ensure that the OpenTTD game engine prioritizes the local development source code over any stable versions downloaded from the "Bananas" content service.
Sources: README.md:46-49
Dependency Management
Trans AI relies on external Squirrel-based libraries to function. These must be manually placed in the ../ai/library folder relative to the AI source code.
Required AI Libraries
The following table outlines the mandatory dependencies:
| Library Name | Purpose | Source Requirement |
|---|---|---|
| AI Library - Common | Base AI utilities | AILibCommon-2 |
| AI Library - List | List processing and filtering | AILibList-3 |
| AI Library - String | String manipulation utilities | AILib.String-2 |
Sources: README.md:40-43
The following diagram illustrates the relationship between the OpenTTD application, the Trans AI source, and its required libraries:
Sources: README.md:40-43
Automated Build and Deployment
While local development involves direct file editing, the project utilizes an automated pipeline for generating releases. This process is handled by GitHub Actions and is defined in the workflow configuration.
Rolling Release Model
Trans AI uses a rolling release model where versioning follows the YYMMDD format based on the commit date.
- Daily Updates: Multiple pushes on the same day update the existing daily release.
- Automated Builds: The pipeline is defined in
.github/workflows/rolling-release.yml. - Deployment: Final builds are packaged as
.tarfiles.
Sources: README.md:45-47, README.md:52-54
CI/CD Workflow Process
The following sequence diagram represents how a local commit transitions to a development release:
Sources: README.md:25-30, README.md:52-54
Licensing and Contributions
Developers must adhere to the GNU General Public License version 2.0. This license applies to all files within the distribution.
- Modification: You may modify the source, but modified files must carry prominent notices stating the changes and dates.
- Distribution: If you distribute the program or a work based on it, it must be licensed under the same terms.
- Contribution Agreement: By contributing code, developers agree to license their contributions under the GNU GPL v2.
Sources: license.txt:104-108, README.md:56-59
Development Roadmap Focus
When setting up the environment, developers should be aware of the current implementation status to identify areas for contribution. Key focus areas include:
- Road and Marine Routes: Requires rework for the "Cargo Concept" (currently at 50% implementation).
- Rail Service: Expanding beyond raw cargo to include passengers and secondary/tertiary industry chains.
- CargoDist: Implementing support for the CargoDist game mode via API.
Sources: ROADMAP.md:36-54