Welcome to the AI Development. Starting from the NoAI branch it is possible for any user to create his own AI. Not only do we deliver a clean and simple API, we also allow you to make your AI in scripts. This should make it possible for anyone with a bit programming knowledge to make pretty good AIs. Also should it challenge people to build better AIs then the ones we currently have in 0.5 release. This page is all about telling you how to do it.
For all pages there is the rule: where examples are given, we will use Squirrel. We suggest everyone who wants to write an AI to read the Introduction as it will explain the basic concept.
Source & binaries
If compiling from source, the files for /src/3rdparty/squirrel have to be checked out from SVN at svn://svn.openttd.org/3rdparty/squirrel
Development milestones article documents most important changes to NoAI framework.
- 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. See here why.
- For comments on all committed changes to the code, see the AI branch commits summary page: http://hg.openttd.org/openttd/branches/noai.hg/
- As of 20 July 2008, the -a option is no longer valid, and replaced with
[ai_players] none = YourAI =
- Introduction to writing an AI for OpenTTD
- Basics of writing an AI
- Things you need to know about writing an AI
- Common pitfalls when working with Squirrel
- Introduction to lists (TownList, TileList, ...)
- Find out how to retrieve error messages after failed build commands
- Trams, and everything related
- Documentation of all API functions can be found in the Doxygen output. For AI API only, check http://noai.openttd.org/docs/
- WrightAI - Builds plane routes only.
To download user made AIs, please have a look at the NoAI forum: http://www.tt-forums.net/viewforum.php?f=65
A tournament system for user made AIs has been created. AIs compete in one-on-one games using same map and same set of rules throughout the whole tournament. Results of past tournaments (including animated gifs!) are available at http://noai.openttd.org/tournament/ . If you'd like your AI to be benchmarked against others, send a tar file to TrueBrain. See this thread on forums for more details.