Page 1 of 1

Creating AIs

Posted: 04 Nov 2014 02:22
by Seven11
I'm kind of new to OpenTTD, and I got to say, the AIs are very talented :D . But I was wondering how it is done, like how are they created? I wanted to see if I could get some advice from someone who knows how. It would be appreciated!

Re: Creating AIs

Posted: 04 Nov 2014 05:59
by krinn
The base are there. http://wiki.openttd.org/AI:Main_Page

AI use squirrel v2 (if i'm right openttd use 2.2) http://www.squirrel-lang.org/doc/squirrel2.html

AI have their API : http://noai.openttd.org/docs/trunk/

You can get your code host there http://dev.openttdcoop.org/projects/aidev

And you can use the bananas service to upload your AI to openttd users : http://bananas.openttd.org/en/ai/


Best way imo is look for an AI that only use roads (because it's the simplest transport to handle), and look at its code to learn.
ps: simpleai now is not as simple as it use to be, but that was one of the AI that help me a lot when start mine, just make SURE and CERTAIN Brumi (simpleai's author) will not test your AI and you'll be fine (else you will get your first bug report)

Re: Creating AIs

Posted: 04 Nov 2014 12:02
by Zuu
When you got something working and want to show and get feedback, create a new thread in this subforum dedicated to your AI. Whenever you upload it to bananas, it is common to use this thread as "website" for the AI.

As such you can use the bananas web interface (or in-game) and click on the website link to get to their forum thread.

If you start out by copying an existing AI, the most important fields to change in info.nut is Name and ShortName, as these are used for save/load and bananas ID. After uploading to bananas, these typically never changes later. Also mind to follow the license of the AI you start from if you copy an existing AI. Most use GPL2 but there are some exceptions.


Edit: It is also a good idea to enable gui.ai_developer_tools. This is detailed in the wiki section that krinn linked you to. It is a good idea to browse that section to at least get an overview of the topics in there. Some you will want to dig deeper into as well.