FastPTPAI

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

11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

FastPTPAI

Post 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 1713 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
Attachments
FastPTPAI-1.tar
(54.5 KiB) Downloaded 799 times
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post by Kogut »

It seems to have trouble with newgrfs (tested in game with US trainset - it was unable to create a proper train).
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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.
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post 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.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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.
Image

SynTrans - A Synaptic Networking AI for OpenTTD
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post 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)
{
}
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post by Kogut »

And the next bug report (in mass AI game, without any interventions, I have no idea what happened here):
Attachments
Bez tytułu.png
Bez tytułu.png (254.91 KiB) Viewed 1711 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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?
Image

SynTrans - A Synaptic Networking AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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.
Attachments
FastPTPAI-2.tar
(55.5 KiB) Downloaded 300 times
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post by 11Runner »

FastPTPAI v3:

* Supports more bulk cargos!
* Fixed some etc. bugs
Attachments
FastPTPAI-3.tar
(60 KiB) Downloaded 309 times
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post by Kogut »

This AI seems to have narrow selection for "good industry". See attached save where it is refusing to make more connections.
Attachments
picky.sav
(140.92 KiB) Downloaded 285 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post by Kogut »

Other problems: train 9, 10 and 4 are on the wrong lines. Train 8 is unable to unload its cargo.
Attachments
ops.sav
(199.2 KiB) Downloaded 294 times
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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 :)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: FastPTPAI

Post 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.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

Re: FastPTPAI

Post 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! :)
Attachments
FastPTPAI-4.tar
(60 KiB) Downloaded 311 times
idioty
Engineer
Engineer
Posts: 59
Joined: 21 Jun 2010 11:54

Re: FastPTPAI

Post 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...
Attachments
Wrong depot position
Wrong depot position
Screen Shot 2014-01-13 at 11.55.33.png (200.89 KiB) Viewed 1705 times
Sorry my bad english, I don't speak english!
User avatar
supermop
Tycoon
Tycoon
Posts: 1104
Joined: 21 Feb 2010 00:15
Location: Fitzroy North - 96

Re: FastPTPAI

Post 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.
Attachments
Screen Shot 2014-01-14 at 5.23.19 PM.png
Screen Shot 2014-01-14 at 5.23.19 PM.png (523.8 KiB) Viewed 1704 times
Baldy's Boss
Tycoon
Tycoon
Posts: 1396
Joined: 23 Feb 2014 22:02

Re: FastPTPAI

Post 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.
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: FastPTPAI

Post 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 12342 times
The AI does very well by the way :)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 9 guests