RoadAI

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

xarick
Transport Coordinator
Transport Coordinator
Posts: 262
Joined: 26 Feb 2015 00:52

Re: RoadAI

Post by xarick » 03 Dec 2018 15:28

RoadAI v5 is underperforming in a variety of tests. I'm unsure what is going on for sure, but I remembre from past versions that this AI used to do much better. Now, it's only capable of maintaining 1 or 2 routes and doesn't develop further than this.
Formerly known as Samu

xarick
Transport Coordinator
Transport Coordinator
Posts: 262
Joined: 26 Feb 2015 00:52

Re: RoadAI

Post by xarick » 21 Dec 2018 22:38

I found out the issue to be the change from SuperLib 39 to 40.

[22:29] <Zuu> Well SuperLib 40 has this change "- RoadPathFinder::FindPath and ::GetFindPathError was not responding as
[22:29] <Zuu> documented
[22:29] <Zuu> " which I assume could break AIs if they expect the undocumented behaviour.
Just tested with an edited RoadAI v5 importing SuperLib 39 instead, and it's now building as fine as before.
Formerly known as Samu

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: RoadAI

Post by Zuu » 21 Dec 2018 22:55

I took a look through RoadAI-4 and -5 and neither uses the mentioned methods directly but rather rely on the high level RoadBulider.

You can dig into changes between SuperLib 39 and 40 here:
https://dev.openttdcoop.org/projects/su ... repository

One thing there is fix of counting of PF loops which apparently was used up too quick in 39 compared to how it was documented. It is possible that it RoadAI benefits from that or there is some other detail in the changes that went wrong or simply made it perform better/worse on certain map types.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: RoadAI

Post by Zuu » 21 Dec 2018 23:43

I looked a bit further on this and RoadAI-4 and -5 specifies max_loops as 500 when it calls RoadBuilder.Init. The default value in the library is 4000. Note that a bug in SuperLib 39 caused it to not abort when the 500 loops were used up, while with SuperLib 40 it does. So I suggest raising the max_loops limit. The vaule you want depends on how long routes RoadAI builds. I don't have a formula so you have to do some trial and error to find out the sweat spot.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests