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

Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

RoadRunner AI

Post by Steffl »

Hi together,

today I want proudly present....


runner.png
runner.png (99.28 KiB) Viewed 18203 times


An AI, which depends on the Pathzilla AI. First I only want to fix some bugs, to get PathZilla to run with new OpenTTD-Versions, but then I can't stop to change things in this AI...
So here it is, which many improvements:

Transports all kinds of cargo,
Better calculation of the required fleet size,
Better protection of going bankrupt,
and many little other things...

Ok, have fun with it and if you find any bugs (I don't hope so), please report it in this thread. I will try to fix them if possible.

And last but not least many many thanks to George Weller for writing the original AI PathZilla. Good work, guy.
Attachments
RoadRunner-9.tar
RoadRunner AI - Version 9
(460 KiB) Downloaded 962 times
Last edited by Steffl on 30 Jun 2013 14:04, edited 23 times in total.
kirky_D
Engineer
Engineer
Posts: 24
Joined: 25 Mar 2010 15:34

Re: RoadRunner AI

Post by kirky_D »

Sorry to say, but I've already found a bug. In this town RoadRunner builds 2 bus stops and a truck stop, but doesn't check that there is a route through the town.

Just look at the roads in the town and you'll see what I mean.
Attachments
Unnamed, 12th Nov 1980.png
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Hi kirky_D,
thanks for testing my AI and for the bug report.
Have you modified something on the game settings? I always thought all roads inside a town are connected to the center. I can't promise you, that I can fix this bug. I think I would have to make bigger changes in the station placement algorithm. I hope the AI sees, that there is no profit on this bus service and then closes it down.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: RoadRunner AI

Post by Zuu »

Actually, the center tile do not always need to be covered road. By default it has road, but it could have been demolished so that a house is placed there later. The player/AI who did that do not need to have done this to be evil.

Another case when you could get the same problem as you got in the screenshot if if the AI find a station location in a nearby town which is not connected by road. This problem has been present both in earlier CluelessPlus and PAXLink versions. You need to do path finding from your bus/truck stops to the tile where you path find from town to town or to the front tile of another bus stop that you know has a road to the road tile that is connected to the other town.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
kirky_D
Engineer
Engineer
Posts: 24
Joined: 25 Mar 2010 15:34

Re: RoadRunner AI

Post by kirky_D »

Steffl wrote:Hi kirky_D,
thanks for testing my AI and for the bug report.
Have you modified something on the game settings? I always thought all roads inside a town are connected to the center. I can't promise you, that I can fix this bug. I think I would have to make bigger changes in the station placement algorithm. I hope the AI sees, that there is no profit on this bus service and then closes it down.
I'm afraid I havn't changed anything in the game. Standard version 1.0.0 release. No newGRF's either.
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Hi together,
I have changed some things on my AI, so that it should build faster on big maps. The bug reported by kirky_D, with not connected town roads should now also been fixed.
You can download the AI from the first post on this thread. I removed the old version.

One thing to RoadRunnerAI:

It's not its only goal, to make as much profit as possible. It tries for example to make heavy used stations, were some trucks deliver raw materials and other take the produced goods to towns. This often make jams, but I let it, as it is, because I think it looks nicer as separated stations. And it often works very good, especially in the early years.

That's all and sorry for my bad english. :P
Attachments
RoadRunner.1.tar
(310 KiB) Downloaded 499 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: RoadRunner AI

Post by Zuu »

Do you handle the case at eg. factories when all loading bays get used by goods trucks that infinitely will try to full load the non-existing goods?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Hmm, yes the AI checks this. It looks how many trucks are waiting for loading and then reduces the fleet size, if there are too much.
But what you said Zuu is still a big problem, because it always needs time to react to changed situations and so jams can never completely be avoided.

One problem with factorys is, that the monthly production can be very different. If a train delivers things to a factory over longer distances, it has a very high production in one month and nothing in the other months. But how to implement this to an AI is difficult. I think you would have to save the production of all factories to get a value over a longer time. Then the calculation of the required number of trucks would be more exact.

I hope I could answer your question. Thanks for your interest. Bye.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: RoadRunner AI

Post by Zuu »

I keep long term sliding mean of the amount of cargo that is waiting on the stations for adjustment of fleet size as well as long time means of how high usage the station has. (similar to your counting of how many loading slots that are used)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: RoadRunner AI

Post by Kogut »

road runner
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (27.19 KiB) Viewed 23497 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Ah my good AI. :-)

Kogut, you have to turn in the AI settings "Build funny, dumb things(yes/no)" from "yes" to "no"
Hope it works :-)
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Today it is time for version 2 of RoadRunner AI.
There are many improvements, like a better handling of bus services, a primitive "ocean detector" and I removed the feature "Build funny, dumb things" (I hope so).

What do you others think of this AI? Is it already good enough to be added to the OpenTTD online content? What could maybe done better?
I know that the code performance and style is very bad. Sorry for that, but I am not really a good programmer. I did it more "just for fun" and the main thing for me is, how it performs in game.
Attachments
RoadRunner.2.tar
RoadRunner version 2
(320 KiB) Downloaded 348 times
Last edited by Steffl on 20 Jun 2010 05:39, edited 1 time in total.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: RoadRunner AI

Post by Kogut »

Steffl wrote:Is it already good enough to be added to the OpenTTD online content?
Yes
Steffl wrote:What could maybe done better?
I think it may be more competitive.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: RoadRunner AI

Post by Brumi »

Erm... I tried RoadRunner v2, and it started to spam a town with tram tracks on its first route. It is OpenTTD 1.0.1, with the Generic Tram Set (and the temperate oil wells only_decrease neutraliser).

EDIT: Always does this when I start a new game with this configuration.
Attachments
tram tracks!.png
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Kogut wrote:I think it may be more competitive.
Hmm, I know the quite slow. But later in game it can reach other AIs. I don't know if I could make it faster because it has still the PathZilla algorithm, which connects first all targets to a network and this is taking some time.

@Brumi: Autsch, this looks like the depot placing algorithm goes mad. I didn't test this version with trams and newGrfs. But I will look what I can do to fix this.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: RoadRunner AI

Post by Kogut »

Steffl wrote:@Brumi: Autsch, this looks like the depot placing algorithm goes mad. I didn't test this version with trams and newGrfs. But I will look what I can do to fix this.
There was sth similar with roads, it was unreported due to following crash of openttd.
And I think it sometimes uses too many mail vans/busses causing very interestaing traffic jams.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Hmm, I can't reproduce this bug. I downloaded the oil wells neutraliser and the Generic Tram Set but the AI still don't make nonsense like in your game..
Have you maybe a save game for me, Brumi?

I know something similar, when the depot placement fails. It searches then many, many places from a depot tile to the station. But it only searches a path and not build roads/trams in my games.
I think it is because the pathfinder tries to connect to the side of an drive through station. I tried to fix this, but it's not working very well.
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: RoadRunner AI

Post by Brumi »

OK then, here is a savegame. The strange thing is that I always encounter this problem with this configuration, so it's easily reproducable for me.
Attachments
roadrunner.sav
(313.03 KiB) Downloaded 417 times
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Thanks Brumi. Now I can see it too. If I found the reason for this bug I will post a new version.
Steffl
Engineer
Engineer
Posts: 103
Joined: 23 Feb 2010 15:44

Re: RoadRunner AI

Post by Steffl »

Bug fixed. The spamming of tram tracks was caused by the depot placing function. It build first the way from depot to station and then the depot. But you can't build a depot on an existing tram track, for a road depot this doesn't matter. So it tries each possible location and the result you can see in Brumi's picture.

@Brumi: I can't reproduce the bug because i usually play maps with smaller cities. And RoadRunner only builds trams if it find a possible connection between two big cities.
And I thank you for reporting this.

One very important function was added. I thought that no good AI could live without a headquarter, so it build one now. I think this is worth the 88$ it costs. :-)

See the attached file as version 2.1.


edit: fixed a little bug
Attachments
RoadRunner.2.tar
RoadRunner - A road-only AI
(320 KiB) Downloaded 402 times
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 8 guests