Page 1 of 4

RoadRunner AI

Posted: 29 Apr 2010 04:52
by Steffl
Hi together,

today I want proudly present....


runner.png
runner.png (99.28 KiB) Viewed 18331 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.

Re: RoadRunner AI

Posted: 29 Apr 2010 08:32
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.

Re: RoadRunner AI

Posted: 29 Apr 2010 14:58
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.

Re: RoadRunner AI

Posted: 29 Apr 2010 15:09
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.

Re: RoadRunner AI

Posted: 29 Apr 2010 15:21
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.

Re: RoadRunner AI

Posted: 23 May 2010 05:12
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

Re: RoadRunner AI

Posted: 23 May 2010 07:07
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?

Re: RoadRunner AI

Posted: 24 May 2010 04:45
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.

Re: RoadRunner AI

Posted: 24 May 2010 21:08
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)

Re: RoadRunner AI

Posted: 30 May 2010 04:57
by Kogut
road runner

Re: RoadRunner AI

Posted: 31 May 2010 18:35
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 :-)

Re: RoadRunner AI

Posted: 14 Jun 2010 04:50
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.

Re: RoadRunner AI

Posted: 14 Jun 2010 05:46
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.

Re: RoadRunner AI

Posted: 14 Jun 2010 07:20
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.

Re: RoadRunner AI

Posted: 14 Jun 2010 08:14
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.

Re: RoadRunner AI

Posted: 14 Jun 2010 08:28
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.

Re: RoadRunner AI

Posted: 14 Jun 2010 19:43
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.

Re: RoadRunner AI

Posted: 15 Jun 2010 07:51
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.

Re: RoadRunner AI

Posted: 17 Jun 2010 04:49
by Steffl
Thanks Brumi. Now I can see it too. If I found the reason for this bug I will post a new version.

Re: RoadRunner AI

Posted: 20 Jun 2010 05:37
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