Page 1 of 2

FastPTPAI

Posted: 10 Jul 2013 17:04
by 11Runner
Hello! I am back!

I have been working on a new train network AI. Along the way, I stumbled on this creation that has entertained me and I think is worthy of being published. It's called FastPTPAI.

As the name implies, it is fast and builds PTP routes. It is very simple, and all it does is build more routes. It does not manage them. It is surprisingly competitive, however.
Company-Stats.png
Company-Stats.png (159.15 KiB) Viewed 2041 times
Pink - FastPTPAI
Blue - Convoy
Red - NoCAB

As with any of my AIs, I am welcome to bug/crash reports, suggestions, etc.

In the future, I hope to add support for multiple trains per route and ro-ro stations. I also need to add slow AI mode. These things should be available for it soon, I just need more time :)

The .tar download for this AI is below, and it will also be available on bananas.

EDIT: Added attachment player color information

Re: FastPTPAI

Posted: 10 Jul 2013 18:50
by Kogut
It seems to have trouble with newgrfs (tested in game with US trainset - it was unable to create a proper train).

Re: FastPTPAI

Posted: 10 Jul 2013 19:05
by 11Runner
OK. It should go with the most expensive bluk cargo and the fastest train with the biggest wagon for the cargo, but as I said, it is quick and dirty. I will take a look at it again. Thanks.

Re: FastPTPAI

Posted: 10 Jul 2013 19:51
by 11Runner
OK, so I tested my AI with ECS cargos. After that, I also tested it with NARS and UKRS. All tests worked. However, when I tested with the 2CC trainset, the train was not able to be built. Unfortunately, I am leaving for vacation today, so I will not be able to resolve the issue until I return.

Re: FastPTPAI

Posted: 10 Jul 2013 20:08
by Kogut
11Runner wrote:the fastest train
Some trainsets have very fast engines that cannot be joined to wagons with cargo other than mail and passengers. US Set is an example. AIAI handles it so feel free to steal code/ideas.

Re: FastPTPAI

Posted: 10 Jul 2013 20:26
by 11Runner
OK. Good to know. Some of my train choosing code was actually based off of MailAI, and i noticed that it handled this problem as well.

Re: FastPTPAI

Posted: 11 Jul 2013 07:24
by Kogut
Also: save and load results in crashed AI due to using undeclared variable saved.

to fix it is enough to replace

Code: Select all

function FastPTPAI::Load(version,data)
{
	saved = true;
}
with

Code: Select all

function FastPTPAI::Load(version,data)
{
}

Re: FastPTPAI

Posted: 11 Jul 2013 13:18
by Kogut
And the next bug report (in mass AI game, without any interventions, I have no idea what happened here):

Re: FastPTPAI

Posted: 29 Jul 2013 02:18
by 11Runner
Kogut wrote:And the next bug report (in mass AI game, without any interventions, I have no idea what happened here):
Sorry for the long wait for reply. I was on vacation.

My best guess for the problem is that another AI built a road there while FastPTPAI was building/pathfinding the route, so it failed to build the track for some reason... Error checking for pathfinding is actually not yet supported. I will look into it right after I fix the train issue. Both of which will happen tomorrow (which is probobly 17 hours from now). Thank you for your reports :) Besides its issues, did the AI perform well for you in your mass AI game test?

Re: FastPTPAI

Posted: 30 Jul 2013 00:33
by 11Runner
FastPTPAI v2 has been released!

I have fixed all the bugs reported by Kogut to the best of my ability. Thank you for your reports!

I was having some Bananas upload issues, so if it is not working well for someone, please let me know. Either way, the AI's .tar is also attached to this post.

Re: FastPTPAI

Posted: 06 Aug 2013 03:06
by 11Runner
FastPTPAI v3:

* Supports more bulk cargos!
* Fixed some etc. bugs

Re: FastPTPAI

Posted: 08 Aug 2013 17:43
by Kogut
This AI seems to have narrow selection for "good industry". See attached save where it is refusing to make more connections.

Re: FastPTPAI

Posted: 08 Aug 2013 18:10
by Kogut
Other problems: train 9, 10 and 4 are on the wrong lines. Train 8 is unable to unload its cargo.

Re: FastPTPAI

Posted: 11 Aug 2013 22:07
by 11Runner
Kogut wrote:This AI seems to have narrow selection for "good industry". See attached save where it is refusing to make more connections.
You are correct about this. I am still working on expanding this AIs compatibility with more cargos. At the moment, however, this AI will only work with cargos marked to be bulk. I should have support for more industries/cargos soon.
Kogut wrote:Other problems: train 9, 10 and 4 are on the wrong lines. Train 8 is unable to unload its cargo.
I think I know why the trains are on the wrong lines, but I am not sure why train 9 is not unloading its cargo yet. I will be sure to fix these issues if possible by the next release. Thank you for your reports :)

Re: FastPTPAI

Posted: 12 Aug 2013 09:07
by Kogut
That is because either station was build too far away from industry (note that it is not accepting coal) or one power station closed and new one was constructed slightly away.

Re: FastPTPAI

Posted: 13 Aug 2013 00:13
by 11Runner
FastPTPAI v4:

This release fixes the bug where trains build on a different track than they are supposed to.
Kogut wrote:That is because either station was build too far away from industry (note that it is not accepting coal) or one power station closed and new one was constructed slightly away.
Yeah, I have made sure that the stations for the AI should always be in range, so I am going to go with the second possibility. Unfortunately, this AI does not support maintenance yet, so if an industry closes that it interacts with, it will be unable to react at this time. I will not be fixing bugs like this for awhile.

Thanks to Kogut for the bug reports! :)

Re: FastPTPAI

Posted: 13 Jan 2014 12:42
by idioty
I tried it, I like it. :)
But often I came across an warning: the AI can't buy an engine type. But I don't use any NewGRF.
And other error: the depot position. I attached the picture...

Re: FastPTPAI

Posted: 14 Jan 2014 22:33
by supermop
Few observations, some of which have been noted already. With the Japan Set (I know, way too exotic...), the AI predictably always builds shinkansens, but is not able to build any cars (no standard gauge freight cars in Japan Set, I believe). However, the AI also connects the stations with low speed standard gauge rail, so the train can't run anyway. (I've made a hobby of cheating to this AI to tweak its networks, cascading its high speed trains to passenger service while preserving its original lines within the network).

I've also noticed in a game with FIRS and OGFX+ trains that the AI does reasonably well, excepting one depot built on a slope so as to be unable to connect to the line, with a train stuck inside, and one case of a line built to collect cargo from a secondary industry that was not being provided with any materials, shown below.

Re: FastPTPAI

Posted: 09 Mar 2014 14:40
by Baldy's Boss
This AI does fairly well against me,I buy out more successful incarnations...but it does tend to ignore the right angle turn prohibition,and traps its trains in depots in locations from which they can't proceed.

Just bought out the latest in the game I play most actively.It had 73 stations of which 35 were unconnected,and in cases had 3 or 4 by the same industry.Also some cases of linking track to platforms the long way around.

Re: FastPTPAI

Posted: 15 Mar 2014 12:57
by Brumi
I found a small bug: the rail line is inaccessible from the depot.
bad depot.png
bad depot.png (63.66 KiB) Viewed 12670 times
The AI does very well by the way :)