Creating New AI

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
Posts: 1
Joined: 12 Oct 2017 23:25

Creating New AI

Post by TheFlame8 »

Hey everybody! I've been a lurker for a while but I'm trying to create my own AI.

I followed all the basic instructions with the info.nut and main.nut files, but my AI doesn't show up as an option when it's in either the Program Files or the documents sub folders (under the AI folder). What do I have to do to fix this? Thank you in advance!

(Note: I've compared my files to other AI ones and the intro stuff and I've done the code correctly, so I'm just confused if I need to compress it or something)
OpenTTD Developer
OpenTTD Developer
Posts: 4762
Joined: 09 Sep 2007 05:03
Location: home

Re: Creating New AI

Post by Alberth »

First check whether the files are detected, by running the openttd program with a -dmisc=9 option (open a command window and type "openttd -dmisc=9" without quotes).
The program dumps files that it finds, which should include your AI files.

For ease of debugging, you may want to move your regular content out of the way temporarily, to avoid too much output.

I am not sure what happens if your files have errors, likely they get reported somewhere, perhaps at the comand window too?
Being a retired OpenTTD developer does not mean I know what I am doing.
Posts: 100
Joined: 12 May 2013 22:28
Location: Argentina

Re: Creating New AI

Post by HGus »

Please post a copy of your info.nut, maybe the problem is there. Also check that your AI is in his own folder in the AIs folder.
Posts: 1
Joined: 15 Feb 2021 06:26

Re: Creating New AI

Post by Vegotenks »

Good Morning,

I recently did the same as the thread-creator and now I have exactly the same problems.
I'm running on Win10, the openttd directory is outside of the user structure created by Windows.
My "OpenTTD" directory is within this user-thing, under documents.
But my AI does not show up when I put it inside the directory <somepath>/openttd-1-10-3/ai/<AI-namespace> or C:Users/<my_username>/Documents/OpenTTD/ai/<AI-namespace>.

I already tried the command line suggested but it didn't work anyway.
Following now the files, as HGus said it could help, because there may be Errors inside.

When increasing the number of AIs, I get a red Error Window saying there are no AIs available, but i could download some via the online content system.

Has anyone experienced this before and would help in some way?

Thank you for your attention.
The AIs Info.nut, very basic, didn't come to far, because it didn't show up.
(585 Bytes) Downloaded 8 times
The AIs Main.nut, very basic, didn't come to far, because it didn't show up.
(1.13 KiB) Downloaded 5 times
Posts: 51
Joined: 13 Aug 2019 17:06

Re: Creating New AI

Post by Firrel »

Vegotenks wrote: 15 Feb 2021 07:11
The short name has to have 4 letters, try if that helps.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 4 guests