AI Development milestones
NoAI Framework

NoAI Main Page

Development

Development milestones
Suggested API changes

AI Programming

API Documentation
Introduction
info.nut file
main.nut file
Basics
Using the road pathfinder
Using the rail pathfinder
Saving / Loading data
Things you need to know
Squirrel
Home page
Common mistakes
Lists
Coping with OTTD errors
Trams
AI Libraries
Forum
Forum FAQ
AI Behavior
ShortNames in use

AIs

TestAI
WrightAI
Convoy
SimpleAI
Comparison of AIs
See forum
See BaNaNaS
All articles in NoAI category

As development progresses, some important changes are introduced to NoAI system. This page documents them. The newest items are on top.

Contents

12 January 2009

NoAI is merged into trunk. Yay!

20 July 2008 - New way of assigning AIs to a (feature) company

As of 2008-08-20 (r13771), a new method of telling which AI should control which company, and with which settings. Because of that, the '-a' command line option is removed. Soon a GUI will be added to ease up editing, but for now you will need to open up 'openttd.cfg' and add/change the next section:

[ai_players]
none = 
YourAI =

You can define up to 8 slots. For each AI starting on that slot (company), that AI you assigned will be started. If a human player starts a company on that slot, the AI info is ignored. 'none' indicates a human company.

20 May 2008 - main.nut is split in two

As of 2008-05-20 (r13194), a new method of registering your AI is in place. This method solves many of the old problems. Like if you have a compile-problem now in your main.nut, at start-up this no longer gives an error. The error shows up when the AI wants to start, and this way we can redirect it to the AI Debug window. This solves the problem where the user had no idea why the AI didn't show up (as many (Windows) users never look at the console). The only thing important now, is that at start-up your info.nut is correct. Which should not be too difficult for most people.

Upgrading from the old system

Basically, what you should do, is move a small part of your main.nut to info.nut. Example:

class FWrightAI extends AIFactory {
	function GetAuthor()      { return "OpenTTD Dev Team"; }
	function GetName()        { return "WrightAI"; }
	function GetDescription() { return "A simple AI that tries to beat you with only aircrafts"; }
	function GetVersion()     { return 1.1; }
	function GetDate()        { return "2008-02-24"; }
	function CreateInstance() { return "WrightAI"; }
}

/* Tell the core we are an AI */
iFWrightAI <- FWrightAI();

Should be removed and info.nut should get:

class WrightAI extends AIInfo {
	function GetAuthor()      { return "OpenTTD Dev Team"; }
	function GetName()        { return "WrightAI"; }
	function GetDescription() { return "A simple AI that tries to beat you with only aircrafts"; }
	function GetVersion()     { return 1.1; }
	function GetDate()        { return "2008-02-24"; }
	function CreateInstance() { return "WrightAI"; }
}

RegisterAI(WrightAI());

Things to remember:

17 March 2008 - C++ support is dropped

As of 17 March 2008, it is no longer possible to write your AI in C++. The only language to write your AI in is Squirrel. This because of several reasons, some listed below:

Of course there are some downsides, which for the records are listed too:

So to summarize it: by removing C++ as possible language to write your AI in, we gain simplicity in the framework, we gain security, and most of all: portability. For those reasons it was unanimous decided to remove C++ as possible language for the NoAI framework.