PAXLink - a PAX-only AI that uses feeder systems

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

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

When I use just the Generic Cars GRF in a game it replaces the original buses. So that there is no normal buses for PAXLink to chose from. Even when I just tried to enable multiple side-by-side GRF sets in advanced settings the normal buses are gone.

If I add LongVehicles 4 for example, PAXLink picks the LV4 vehicles as they happen to get higher score in the vehicle selection.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
cmoiromain
Chief Executive
Chief Executive
Posts: 655
Joined: 15 Jan 2007 21:45
Location: FRANCE
Contact:

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by cmoiromain »

I enabled both generic cars and egrvts. Other AIs chose the buses from egrvts, PAXLink didn't...
I am little, ugly, and nasty. How do you do?
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4765
Joined: 09 Sep 2007 05:03
Location: home

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Alberth »

PAXlink 12 crashed in my game with the following message:

Code: Select all

dbg: [ai] [3] [S] Your script made an error: idx out of range
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] *FUNCTION [RemoveInvalidStations()] /home/hat/.openttd/content_download/ai/PAXLink.12.tar/paxlink.12/townmanager.nut line [335]
dbg: [ai] [3] [S] *FUNCTION [ReadStatisticsData()] /home/hat/.openttd/content_download/ai/PAXLink.12.tar/paxlink.12/townmanager.nut line [342]
dbg: [ai] [3] [S] *FUNCTION [UpdateTownStatistics()] /home/hat/.openttd/content_download/ai/PAXLink.12.tar/paxlink.12/townmanager.nut line [49]
dbg: [ai] [3] [S] *FUNCTION [Start()] /home/hat/.openttd/content_download/ai/PAXLink.12.tar/paxlink.12/main.nut line [309]
dbg: [ai] [3] [S]
dbg: [ai] [3] [S] [@ITERATOR@] 3
dbg: [ai] [3] [S] [remove] 3
dbg: [ai] [3] [S] [_] 2
dbg: [ai] [3] [S] [remove_list] ARRAY
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [@ITERATOR@] 40
dbg: [ai] [3] [S] [town_manager] INSTANCE
dbg: [ai] [3] [S] [_] 39
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] [3] [S] [this] INSTANCE
dbg: [ai] The AI died unexpectedly.
Screenshot of the debug window: http://devs.openttd.org/~alberth/paxlink12_crash.png
Don't take too much attention of the red text at the bottom, it looks like a repetition of the text at the top.

Save game loads at my clean r16077 trunk
Attachments
many-ais.sav
save game, crash happens 1st half of september
(217.83 KiB) Downloaded 165 times
rsdworker
Traffic Manager
Traffic Manager
Posts: 149
Joined: 18 Mar 2009 13:58

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by rsdworker »

i had paxlink on my map - the al didn't expand - just stuck to one station in one town

here a screenshot of it and saved the game - its shows the AL is not growing
see the al debug that reports he had stopped building = possibly crashed but no red texts
Attachments
Fort Martburg Transport, 7th May 1985.sav
(76.8 KiB) Downloaded 185 times
Fort Martburg Transport, 29th Mar 1986.png
Fort Martburg Transport, 29th Mar 1986.png (73.39 KiB) Viewed 1652 times
rsdworker
Traffic Manager
Traffic Manager
Posts: 149
Joined: 18 Mar 2009 13:58

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by rsdworker »

bump - anyone can solve this?
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zutty »

The save game loads with MedievalAI for me, and it crashes almost immediately.

It could be something to do with ECS vectors. Specifically I think its related to tourists. Have you tried either...

A) Disabling the town vector
B) Using a houses set that is compatible with ECS (TTRS for instance)

I dont know about Medieval/PAXLink, but my own AI didn't like it when tourists existed as a cargo, but were not actually generated by any town.
PathZilla - A networking AI - Now with tram support.
rsdworker
Traffic Manager
Traffic Manager
Posts: 149
Joined: 18 Mar 2009 13:58

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by rsdworker »

Zutty wrote:The save game loads with MedievalAI for me, and it crashes almost immediately.

It could be something to do with ECS vectors. Specifically I think its related to tourists. Have you tried either...

A) Disabling the town vector
B) Using a houses set that is compatible with ECS (TTRS for instance)

I dont know about Medieval/PAXLink, but my own AI didn't like it when tourists existed as a cargo, but were not actually generated by any town.
so where is TTRS? could you point out for me
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zutty »

Sorry I thought it would have been on bananas by now...

http://users.skynet.be/florisjan/ttd/ttrs.html
PathZilla - A networking AI - Now with tram support.
Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Wold »

Shouldn't the AI check if the 2 cities are too close?
Attachments
Unnamed, 31st Mar 1960.png
Unnamed, 31st Mar 1960.png (107.83 KiB) Viewed 1655 times
Image
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

Regarding tourists the AI has one function GetPAXCargo in helper.nut that using the available cargo class checking methods try to figure out what ID passengers has. If you want to use town vectors you are free to propose changes to that function to make it compatible with original OpenTTD as well as town vectors.
Wold wrote:Shouldn't the AI check if the 2 cities are too close?
In the current version of PAXLink the decision to build bus stops in a town and to build an airport in that town are two somewhat independent choices. A third somewhat independent choice is to add a new air-line. In this choice if it has more than two airports to choose from, it try to pick a pair with longer distance. But if it only has two airports to choose from (most common) situations as the one you posted can happen.

Yes this is not always good, but that is what can happen with independent decisions. There are plans for expanding the town "model" to make better decisions, but I am afraid currently I don't even have time to regularly visit the forums.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Wold »

Well the AI had a choice of 4 airports and it chose that 2, that's why I reported it.

And something for a little tweaking:
Attachments
Duninghall Transport, 19th Feb 1963.png
Duninghall Transport, 19th Feb 1963.png (131 KiB) Viewed 1624 times
Duninghall Transport, 15th Jul 1963.png
Duninghall Transport, 15th Jul 1963.png (109.83 KiB) Viewed 1616 times
Image
mwyeoh
Engineer
Engineer
Posts: 28
Joined: 21 May 2009 05:36
Location: Perth, Australia

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by mwyeoh »

Just posting an AI crash

Basic game
no newgrfs
single player only
screen.png
(143.27 KiB) Downloaded 62 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

mwyeoh wrote:Just posting an AI crash

Basic game
no newgrfs
single player only
screen.png

Thanks

Hmm, that one, though I disabled it but maybe not. Was many weeks ago I sat with the code last. I've kept myself busy with traffic models at university the last weeks.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
mwyeoh
Engineer
Engineer
Posts: 28
Joined: 21 May 2009 05:36
Location: Perth, Australia

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by mwyeoh »

I have observed an 'oversight' with PAX

Since the generic tram set is now part of the game, when building buses, the AI does not check whether the 'road' it is connecting to is roads or tram lines

version 0.7.0
Cundwood Transport, 6th May 2000.png
(379.18 KiB) Downloaded 80 times
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

Thank you for your report, that is indeed something I didn't consider.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

I just want to tell that I've looked into PAXLink and tried to change the code so that it does no longer use call-functions nor calling DoCommands from other places where it is now forbidden.

After having spent an hour or two on that I got that part to work, but found out that the townmanager crashed for some reason which I didn't have time to debug extensively enough at that time. So I have disabled PAXLink on Bananas for now. Because it doesn't make sense to use it in the current state when it does nothing at all but spaming the log window with error messages in the latest nightlies. Not sure when I'll be able to get it back running again.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Carnildo
Engineer
Engineer
Posts: 5
Joined: 26 Jun 2007 18:05

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Carnildo »

Got a situation for you where the AI has trouble: in one of my games, the AI built a town's intercity airport next to an industry that accepted passengers (a steel mill, IIRC) rather than near the town itself. All well and good, except that the industry went out of business and there are now two airports and four airplanes doing nothing but accumulate cargo.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

Thanks for taking your self time to report the problem. I can not say anything when it will get fixed as the problems mentioned in my previous post have to be solved first, so that PAXLink get back workning on last nightly. Then to solve your problem it will need to know how to close down an airport and do so when it loses acceptance for passengers.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by Zuu »

I'm happy to tell you that PAXLink is now again working with recent nightlies. [Edit: On 0.7.1 it seams to act strange. ] [Edit2: I couldn't reproduce the strange behavior when I had restarted OpenTTD with "-d ai=5". The strange behavior that I first noticed was that it removed grid bus-stops and many buses ended up with all orders invalid. ]

Changes:
  • Don't use call/pcall for valuator replacement, instead use Yexos code from AdmiralAI that do not use call/pcall.
  • Fixed the by mwyeoh reported bug related to tram tracks. PAXLink will no longer build grid stations next to tram tracks with no road. (and if the road is removed but the tram is still there PAXLink removes the road station)
  • Fixed the by Carnildo reported problem of when an inter city station (airport) stops accepting passengers. First, airplanes stop servicing it, then the buses and lastly the inter city station is removed. If it is so fast that there is still a bus on one of the bus stops it delays a bit, but not forever so in some rare cases a bus stop might be left over from the inter city station. And currently PAXLink does not remove non-grid bus stops that are not part of an IC station.
  • I hope I have fixed the bug mentioned by Alberth and mwyeoh above. I could not reproduce it, but I realized by reading my code what could go wrong and have rewritten it so it should be safe now. The code removed zero, one or more items from an squirrel array. I made a list of all indexes to remove and then looped over the to_remove array and removed the items from the array of stations in a town. The problem is that when one station is removed, indexes with an higher number gets wrong. As opposed to when using pointers/iterators in C++ where the pointer will still point on the correct item even if some other elements have been removed.
Attachments
PAXLink-v13.tar
(123.5 KiB) Downloaded 245 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
User avatar
fanioz
Transport Coordinator
Transport Coordinator
Posts: 320
Joined: 19 Dec 2008 05:03
Location: Indonesia
Contact:

Re: PAXLink - a PAX-only AI that uses feeder systems

Post by fanioz »

:D well done zuu. It seems like morloth has been waiting for you to fix Pax-Link, to join on his small tournament. :D
Correct me If I am wrong - PM me if my English was bad :D

**[OpenTTD AI]** Image
***[NewGRF] *** Image
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 5 guests