Page 1 of 1

How to make Ai?

Posted: 19 May 2020 17:39
by openttdfan2020
I really like those ais.
But i wanna make the ai just like them.
IDK how to make those, Can you help me guys?
:D

Re: How to make Ai?

Posted: 19 May 2020 17:45
by jfs
Long story short:
1. Learn the Squirrel programming language
2. Learn the OpenTTD AI API
3. Look at existing AIs and available AI libraries for examples and bases to start from
4. Write some code

Re: How to make Ai?

Posted: 20 May 2020 08:18
by Yexo
The wiki has a few interesting pages for you:. Start with https://wiki.openttd.org/NoAI and https://wiki.openttd.org/AI:Introduction.

Re: How to make Ai?

Posted: 26 May 2020 00:37
by RockyPapery
I would love to make one too. The problem is there is no one explaining how to install the squirrel. I do code but for some reason installing squirrel language is like walking in a labyrinth and there is no instruction anywhere. The only thing I found is how to install SQuirrel DataBase, bummer.

Re: How to make Ai?

Posted: 26 May 2020 06:45
by jfs
You don't need to install Squirrel, everything required to run the AI is already built into OpenTTD. All you need is a text editor to write the code, and place the files in the right location.

Re: How to make Ai?

Posted: 27 May 2020 14:12
by RockyPapery
Ooh that's great. So how do I debug then, you know, to check some spelling error, missing semicolon, etc?
And how do I type Squirrel language without autocomplete and libraries? I do code in C++ though

Re: How to make Ai?

Posted: 27 May 2020 17:33
by jfs
I believe there is Squirrel syntax highlighting available for most major text editors, e.g. VS Code and Notepad++ should have it. I don't know about any autocompletion tools.
You can run OpenTTD with debug logging enabled to get syntax errors printed when it tries to load a script.