RoadRunner 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

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

Re: RoadRunner AI

Post by xarick »

RoadRunner v9, OpenTTD 1.6.1-RC1

I was running a competition to find out the best Road Vehicle AI, but I had to disclassify RoadRunner. I tested it in a dedicated server environment and I noticed by the year 1990 that it was building vehicle models way before they're designed. I saw, for example, Perry Mail Trucks which are only designed way later. I've also seen MKII buses.

Since I keep all autosaves, on a monthly rate, I went to check further back when did it first start using these models, I went all the way back to 1st Jan 1957. In 1st Dec 1956, it was still legit, so I'm providing these two savegames, but if more savegames are needed, please tell. I have monthly saves since 1950 to 1991. Then I stopped the server.

Another thing I noticed, is that all the other competing AIs, running on their respective servers, are not cheating. All AIs are subject to the same map seed, same game settings, other than different server ports. Before I abandoned the server, I created a company to see if I also had access to those affected models, but I didn't. It was only RoadRunner company who had access to them.
Attachments
RoadRunner, 1st Jan 1957.sav
(1.94 MiB) Downloaded 189 times
RoadRunner, 1st Dec 1956.sav
(1.94 MiB) Downloaded 183 times
openttdCore2.cfg
(11.15 KiB) Downloaded 185 times
Formerly known as Samu
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: RoadRunner AI

Post by Kogut »

RoadRunner crashes in 1952 in running from that save (hopefully it is not depending on buggy AIAI, in case that this specific version of AIAI is necessary to reproduce I attached it)
Attachments
reproducible crash.sav
(129.79 KiB) Downloaded 172 times
Selection_002.png
Selection_002.png (15.42 KiB) Viewed 1247 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
_Steffl_
Engineer
Engineer
Posts: 7
Joined: 07 Oct 2016 04:14

Re: RoadRunner AI

Post by _Steffl_ »

Hello,

after long time I decided to look back into this thread and I thought it was time to fix the bugs and make a new version.

The bug xarick mentions when he thinks RoadRunner cheats was funny, as the AI accidently exploits a bug in OpenTTD which let a company in slot 0 accept a preview, even if no preview was offered.
It is fixed in new versions of OpenTTD and I added a break statement which was missing, so new RoadRunner version can be running in older versions of OpenTTD without cheating, too.
I found the IRC log where someone found the problem: https://webster.openttdcoop.org/index.p ... 1465486222

The bug reports from Kogut and wormnest are for the same bug and I hope adding more checks in an if statement should fix it.
Thanks for reporting to you all.



Edit: removed download, see 2 posts below for new version.
Last edited by _Steffl_ on 09 Oct 2016 13:15, edited 2 times in total.
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: RoadRunner AI

Post by xarick »

Will it be uploaded to banana server?
Formerly known as Samu
_Steffl_
Engineer
Engineer
Posts: 7
Joined: 07 Oct 2016 04:14

Re: RoadRunner AI

Post by _Steffl_ »

xarick wrote:Will it be uploaded to banana server?
Hi,
Uploaded now to bananas with some minor improvements.



Download in game over bananas or direct from here:
RoadRunner-10.tar
RoadRunner - Version 10
(470 KiB) Downloaded 190 times
_Steffl_
Engineer
Engineer
Posts: 7
Joined: 07 Oct 2016 04:14

Re: RoadRunner AI

Post by _Steffl_ »

Hello,

again a new version because I found a bug in the code.
RoadRunner sometimes purchased new vehicles for stations where already too many vehicles were waiting for cargo. With this new version hopefully RoadRunner's performance is much better later in the game.


Download link in attachment or you can download it in game from bananas.
Attachments
RoadRunner-11.tar
RoadRunner AI - Version 11
(470 KiB) Downloaded 194 times
User avatar
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: RoadRunner AI

Post by romazoon »

just wanted to say i really like your AI ! i really like how it adapt to the transport offer by reducing or adding vehicles !

a couple things though :

- would it be possible to make the AI use shared orders? that would be a good step to prevent from reaching too soon the number of orders limit in a game (and because when using the never full order setting, and jgrpatchpacks i d love to put roadrunner's vehicle on automated separation to prevent the bunching up of vehicles)

- compete agressively was off, yet i ve seen it competing with some of my existing lines were i had some quite high ratings (see screenie), is that intended ?

anyway, thanks for that awesome ai ;)
Attachments
Make Britain Great Again, 16 Sep 2262.png
blue is me, pink is road runner
(161.99 KiB) Not downloaded yet
_Steffl_
Engineer
Engineer
Posts: 7
Joined: 07 Oct 2016 04:14

Re: RoadRunner AI

Post by _Steffl_ »

Hello,
romazoon wrote: just wanted to say i really like your AI ! i really like how it adapt to the transport offer by reducing or adding vehicles !
thanks you like the AI. Nice to hear. :-)

romazoon wrote: - would it be possible to make the AI use shared orders? that would be a good step to prevent from reaching too soon the number of orders limit in a game (and because when using the never full order setting, and jgrpatchpacks i d love to put roadrunner's vehicle on automated separation to prevent the bunching up of vehicles)
I didn't work on the AI for some years and forgot some details, but I think I didn't use shared orders because for example a passenger transport can has multiple stations in one city. Then if the AI decides to build more busses for this connection it searches the 2 stations in both cities which needs the busses the most. So this leads to vehicles in one station have different orders. And I didn't want to give only the vehicles build first shared orders, but the vehicles build later not.
I could easily make a modified version where only some vehicles have shared orders, to be honest I didn't think reaching the order limit was a problem.

And to avoid bunching up of vehicles I would use full load orders and maybe set amount of traffic the AI should generate to "medium". I tried to make RoadRunner not to produce to much jams even with full load orders.

romazoon wrote:
- compete agressively was off, yet i ve seen it competing with some of my existing lines were i had some quite high ratings (see screenie), is that intended ?
Yes it is intended. This setting don't forbids competion completely. It just changes calculation of which routes the AI should build next. If it is not set to aggressive it should prefer targets where no freight is transported already.
I think the main point of this setting was to let the AI build near your transport routes when setting is aggressive. This is to let the AI interact more with the player on large maps, otherwise maybe the player builds in one corner of the map and the AI in the other, which could be boring sometimes.
User avatar
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: RoadRunner AI

Post by romazoon »

hi and thanks for taking time answering my question ;)
_Steffl_ wrote:this leads to vehicles in one station have different orders.
ok, well in that case of course it s a different "line" so shared orders is out of question, but when it makes a exact copy of a vehicle i dont see a technical reason to not make them share their orders, or, are you telling me the AI may update some vehicle's orders after doing a copy ? (i haven t seen it doing that so far, it s doing a point to point service with only exact copies in my game, and seems to sell the unprofitable ones rather than sending them somewhere else...but i haven t checked that so closely too)

now on the point of reaching the number of orders limits, i frankly never seen it happens, but i do believe someone did report it once on the forum, and the main reason from happening was apparently the use of "not shared orders"

anyway, i understand i m asking you for something not very necessary to make your AI working great, so i ll be happilly using it no matter what you do, or not do ;)
_Steffl_ wrote: it should prefer targets where no freight is transported already
thanks for the enlightment, well i m happy that he builds near by me, cause that s what i want it to do....but it does take lot of my allready served industries (sometime copying my line) while there is plenty that are not served near by ( and i suspect the problem is that the AI prefers competing with me for the high production sites, instead of serving a mines/forest/farm/factory producing very little because they are ECS industries, wich never produce much without highly rated and long term service ->it s logic in a way because half of 2000 tons from a maxed out iron mines, will always be better than 100% of 6 tons of not yet serviced iron mine from ECS... but now i really don t want him to compete directly, i want him to serve the industries that i don t serve)

i would suggest you to change the name of the existing parameter to something like " may and will compete a little with you" that would be less missleading, and maybe add one for no competition at all.
_Steffl_ wrote: I would use full load orders and maybe set amount of traffic the AI should generate to "medium"
i should try that indeed, though i m not sure that s gonna work great in a daylenght x6 game, but i ll try and see ;)
_Steffl_
Engineer
Engineer
Posts: 7
Joined: 07 Oct 2016 04:14

Re: RoadRunner AI

Post by _Steffl_ »

Hello all,
I made a new version with all the suggestions from romazoon. Thanks to you for taking time to give me feedback, so I could make this improvements.

New features:

- vehicles now use shared orders instead of copied orders.

- new setting in the AI menu for setting a maximum transport percentage limit. RoadRunner will not plan and build new transport routes for industries or cities where already more then the selected percentage for a freight are transported.
If you want, you can set it to 0 and RoadRunner should never build stations near already served industries and cities.

- works now correct with modified daylength settings, because before its calculations got messed up with it and it bought way too many vehicles for new transport routes.



Needs a bit more tests, then I upload it to bananas too.
Attachments
RoadRunner-12.tar
RoadRunner AI - v12 (testversion)
(470 KiB) Downloaded 208 times
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: RoadRunner AI

Post by xarick »

Crash!

Code: Select all

dbg: [script] [0] [I]    Need more vehicles at Lower Plarbourne
dbg: [script] [0] [I]    Need more vehicles at Plarbourne Heights
dbg: [script] [0] [I]    Need more vehicles at Wrinninghall East
dbg: [script] [0] [I]    Need more vehicles at Plarbourne
dbg: [script] [0] [I]    Need more vehicles at Batbridge Valley
dbg: [script] [0] [I]    Need more vehicles at Sartbourne Mines
dbg: [script] [0] [I]    Need more vehicles at New Petston Transfer
dbg: [script] [0] [I]    Need more vehicles at New Panway Transfer
dbg: [script] [0] [I]    Need more vehicles at Neham West
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]     Trying to find a path between [895, 155] and [897, 165]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Building a road...
dbg: [script] [0] [I]     Done building road.
dbg: [script] [0] [I]  Building a road between Wrenington Farm and Flenfingbridge...
dbg: [script] [0] [I]     Trying to find a path between [897, 165] and [913, 189]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Building a road...
dbg: [script] [0] [I]     Done building road.
dbg: [script] [0] [I]  Building a road between Flenfingbridge and Fonfingbridge Iron Ore Mine...
dbg: [script] [0] [I]     Trying to find a path between [913, 189] and [956, 262]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]     Trying to find a path between [913, 189] and [941, 251]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Building a road...
dbg: [script] [0] [I]     Done building road.
dbg: [script] [0] [I]  Building a road between Fonfingbridge Iron Ore Mine and Beningworth Power Station...
dbg: [script] [0] [I]     Trying to find a path between [941, 251] and [960, 322]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]     Trying to find a path between [941, 251] and [959, 297]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Building a road...
dbg: [script] [0] [I]     Done building road.
dbg: [script] [0] [I]  Building a road between Beningworth Power Station and Gondingville...
dbg: [script] [0] [I]     Trying to find a path between [959, 297] and [959, 442]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Trying to improve path...
dbg: [script] [0] [I]     Trying to find a path between [959, 442] and [959, 297]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]     Trying to find a path between [959, 297] and [959, 442]...
dbg: [script] [0] [I]       Done finding path.
dbg: [script] [0] [I]       Path successfully shortened by 4 tiles
dbg: [script] [0] [I]       Building a road...
dbg: [script] [0] [S] Your script made an error: the index 'pptile' does not exist
dbg: [script] [0] [S] 
dbg: [script] [0] [S] *FUNCTION [BuildPath()] roadrunner-12\pathfinding\PathWrapper.nut line [879]
dbg: [script] [0] [S] *FUNCTION [TryBuildPath()] roadrunner-12\pathfinding\PathWrapper.nut line [84]
dbg: [script] [0] [S] *FUNCTION [BuildInfrastructure()] roadrunner-12\manager\RoadManager.nut line [655]
dbg: [script] [0] [S] *FUNCTION [ImplementService()] roadrunner-12\service\ServiceManager.nut line [762]
dbg: [script] [0] [S] *FUNCTION [Start()] roadrunner-12\main.nut line [842]
dbg: [script] [0] [S] 
dbg: [script] [0] [S] [mtile] 341951
dbg: [script] [0] [S] [attempts] 1
dbg: [script] [0] [S] [success] true
dbg: [script] [0] [S] [distance] 2
dbg: [script] [0] [S] [ptile] 340927
dbg: [script] [0] [S] [tile] 342975
dbg: [script] [0] [S] [par] INSTANCE
dbg: [script] [0] [S] [stopList] INSTANCE
dbg: [script] [0] [S] [prevTile] 343999
dbg: [script] [0] [S] [ilo] 0
dbg: [script] [0] [S] [roadType] 0
dbg: [script] [0] [S] [path] INSTANCE
dbg: [script] [0] [S] [this] INSTANCE
dbg: [script] [0] [S] [success] -1
dbg: [script] [0] [S] [tries] 0
dbg: [script] [0] [S] [service] NULL
dbg: [script] [0] [S] [features] ARRAY
dbg: [script] [0] [S] [demolish] true
dbg: [script] [0] [S] [ignoreTiles] ARRAY
dbg: [script] [0] [S] [roadType] 0
dbg: [script] [0] [S] [toTile] 453567
dbg: [script] [0] [S] [fromTile] 305087
dbg: [script] [0] [S] [path] INSTANCE
dbg: [script] [0] [S] [this] INSTANCE
dbg: [script] [0] [S] [feat] ARRAY
dbg: [script] [0] [S] [stations] INSTANCE
dbg: [script] [0] [S] [edge] INSTANCE
dbg: [script] [0] [S] [walk] INSTANCE
dbg: [script] [0] [S] [b] INSTANCE
dbg: [script] [0] [S] [a] INSTANCE
dbg: [script] [0] [S] [jp] 0
dbg: [script] [0] [S] [bTarget] INSTANCE
dbg: [script] [0] [S] [aTarget] INSTANCE
dbg: [script] [0] [S] [ww] 8
dbg: [script] [0] [S] [wwg] 0
dbg: [script] [0] [S] [path] INSTANCE
dbg: [script] [0] [S] [to] INSTANCE
dbg: [script] [0] [S] [from] INSTANCE
dbg: [script] [0] [S] [next] 1
dbg: [script] [0] [S] [prev] 0
dbg: [script] [0] [S] [noway] 0
dbg: [script] [0] [S] [sub] 0
dbg: [script] [0] [S] [aw] 29
dbg: [script] [0] [S] [qba] false
dbg: [script] [0] [S] [success] true
dbg: [script] [0] [S] [tloc] 159613
dbg: [script] [0] [S] [floc] 493477
dbg: [script] [0] [S] [subschema] INSTANCE
dbg: [script] [0] [S] [pathb] INSTANCE
dbg: [script] [0] [S] [subb] false
dbg: [script] [0] [S] [subs] false
dbg: [script] [0] [S] [owater] 112800.265625
dbg: [script] [0] [S] [fl] false
dbg: [script] [0] [S] [stowns] INSTANCE
dbg: [script] [0] [S] [tgg] INSTANCE
dbg: [script] [0] [S] [tg] INSTANCE
dbg: [script] [0] [S] [ind] false
dbg: [script] [0] [S] [station] true
dbg: [script] [0] [S] [targetsUpdated] INSTANCE
dbg: [script] [0] [S] [schema] INSTANCE
dbg: [script] [0] [S] [service] INSTANCE
dbg: [script] [0] [S] [this] INSTANCE
dbg: [script] [0] [S] [schema] INSTANCE
dbg: [script] [0] [S] [success] false
dbg: [script] [0] [S] [ll] 0
dbg: [script] [0] [S] [tw] 0
dbg: [script] [0] [S] [cont] 0
dbg: [script] [0] [S] [pi] 4
dbg: [script] [0] [S] [bestService] INSTANCE
dbg: [script] [0] [S] [this] INSTANCE
dbg: [script] [0] [S] [sok] NULL
dbg: [script] [0] [S] [expansionInterval] 20
dbg: [script] [0] [S] [maintenanceInterval] 40
dbg: [script] [0] [S] [workInterval] 10
dbg: [script] [0] [S] [latency] 0
dbg: [script] [0] [S] [sserlog] 734381
dbg: [script] [0] [S] [serlog] 734502
dbg: [script] [0] [S] [startDate] 712223
dbg: [script] [0] [S] [noServices] false
dbg: [script] [0] [S] [targetTile] 958565
dbg: [script] [0] [S] [tileList] INSTANCE
dbg: [script] [0] [S] [searchRadius] 36
dbg: [script] [0] [S] [stlist] INSTANCE
dbg: [script] [0] [S] [vlist] INSTANCE
dbg: [script] [0] [S] [this] INSTANCE
dbg: [script] The script died unexpectedly.
Attachments
RoadRunner, 1st Apr 2011.sav
last month alive
(1.95 MiB) Downloaded 174 times
RoadRunner, 1st May 2011.sav
dead
(1.94 MiB) Downloaded 180 times
Formerly known as Samu
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: RoadRunner AI

Post by fanioz »

Crash: Cannot iterate null
Attachments
RoadRunner.png
RoadRunner.png (28.8 KiB) Viewed 1247 times
autosave8.sav
(672.41 KiB) Downloaded 158 times
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
User avatar
sevenfm
Engineer
Engineer
Posts: 117
Joined: 25 Jul 2016 23:44
Location: Soviet Russia

Re: RoadRunner AI

Post by sevenfm »

Tested this AI with actual JGR 0.32 with roadtypes, seems that it cannot build any road, it can plan for years and build nothing, only a few stations and depots. If I manually build road, it will build cars and use it.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 6 guests