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: 20 Oct 2019 15:17


Post by krakeusz »

Hi guys,

I present you with an AI that uses only trucks, lots of them.

- works with NewGRF cargos
- automatically adjusts vehicle numbers (buying and selling)
- supports save and load
- tries to be competitive

Download from BaNaNaS: ... I-2.tar.gz

(408.4 KiB) Not downloaded yet
(935.75 KiB) Not downloaded yet
v2: Fixed AI not working when packed in .tar archive, which was the case for BaNaNaS.
v1: Initial version

User avatar
Graphics Moderator
Graphics Moderator
Posts: 5471
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: KrakenAI

Post by PikkaBird »

Nice to see another new AI in development!

I note that your AI never builds anything a recent nightly, although it works fine in 1.9. Could be something to do with roadtypes perhaps.

Also, as some general advice; renaming stations with codes is great for testing, but doesn't look nice from a player's point of view; and adding some randomness to the route selection can be good so if there are multiple instances of your AI running, they won't constantly build on top of each other.

User avatar
Posts: 1012
Joined: 21 Oct 2005 09:26
Location: Birmingham, England

Re: KrakenAI

Post by 3iff »

I tried this and it's quite good, very aggressive. I like the way it builds 3x3 roro stations and even reuses them.

I've found a few issues that I'd like to report.

Sometimes it builds 2 or even 3 pickup stations at a single place even though there's only one product to pickup. It does tend to clutter the map when it does that, as well as blocking access for other players (or perhaps that's a deliberate action!).

I use the SPI industry set when can be set to have industries close down after a time (running out of resources or bankruptcy). Kraken can't deal with this as it doesn't appear to recognise that the industry has disappeared. Trucks simply remain in place and generate losses. I have managed to change the code a little bit to cope with this and trucks now run off and sell themselves when this happens. Unfortunately I haven't brought those code changes with me...but I can let you know what they were when I'm next on the internet (next week). It was only 2-3 lines.

Also, Kraken had a service at a coal mine. I added 2 competing services that gained all the coal produced. Krakens two trucks then sat there for 30+ years with a zero chance of ever getting any coal. They constantly lost money but had no way of closing down the service.

However, it's quite a nice AI and I shall continue to use it.

Oh, I also made a couple of changes to try and have trucks share orders. It makes it MUCH easier if/when I take over the company. It's not 100% right as the first 1 or 2 trucks are not sharing orders, but all other trucks of that service do manage to share orders.

Finally for now, when a truck group has no trucks remaining it isn't deleted, so the group list for that AI can be filled with empty groups.

There's also the company naming code I wrote for SimpleAI. I can have a look at adding that to this code which might be preferable to calling each company Kraken#n. If I can do this, you are welcome to include it should you wish.

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest