PathZilla (v6) - A networking 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

Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: PathZilla (v4) - A networking AI

Post by Yexo »

comm Cody wrote:Zutty i think there some thing wrong.....

*** OpenTTD Crash Report ***
...snip...
This is a bug in NoAI, and has nothing to do with PathZilla. You should report it at flyspray

bokkie
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 19 Jan 2007 19:26

Re: PathZilla (v4) - A networking AI

Post by bokkie »

Gave your AI a little test, the network it builds is quite cool and should be suitable for cargodest :). Some things I noticed
- It places some signs called ':ERR_LAND_SLOPED_WRONG'. I guess this isn't suppose to happen anymore?
- Distances between cities are sometimes a bit large for road vehicles, see the screenshot. As you can see, Pathzilla connected the city in the upper center to the city in the lower center (and the middle btw), which is very far away. (Also: bridges aren't placed that smart. On the other hand, it actually succeeded in building the routes by using bridges so that's also an accomplishment!).
- No shared orders
- In some cities in which mail is transported, passengers aren't
Attachments
Dokmere Transport, 3 Okt 1963.png
(330.72 KiB) Downloaded 285 times

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v4) - A networking AI

Post by Zutty »

bokkie wrote:Gave your AI a little test, the network it builds is quite cool and should be suitable for cargodest :). Some things I noticed
- It places some signs called ':ERR_LAND_SLOPED_WRONG'. I guess this isn't suppose to happen anymore?
- Distances between cities are sometimes a bit large for road vehicles, see the screenshot. As you can see, Pathzilla connected the city in the upper center to the city in the lower center (and the middle btw), which is very far away. (Also: bridges aren't placed that smart. On the other hand, it actually succeeded in building the routes by using bridges so that's also an accomplishment!).
- No shared orders
- In some cities in which mail is transported, passengers aren't
Thanks very much for testing bokkie. Sorry for my very very late reply. I AM still interested in bug reports - I can;t tell you how useful it is to get bug reports from people :)

1) This is a bit of debugging that I left in by mistake. I am going to completely change the way stations are picked so this will hopefully be solved.
2) This is sadly unavoidable when PathZilla is only capable of building RVs. I will address this in future when other transport types are introduced. Note that PZ will only EVER build a service that is porfitable (or that it estimates will be profitable!).
3) What are shared orders? :oops: TBH I'm not actually very skilled at playing OpenTTD! If someone could enlighten me I'd be greatful!
4) Is it preferable to transport mail only is towns with pax services too?

You can expect a new version of PathZilla within the next few days, depending on how much real-life work I can avoid doing!
PathZilla - A networking AI - Now with tram support.

Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: PathZilla (v4) - A networking AI

Post by Roujin »

Zutty wrote:[...]
3) What are shared orders? :oops: TBH I'm not actually very skilled at playing OpenTTD! If someone could enlighten me I'd be greatful!
[...]
See here: http://wiki.openttd.org/wiki/index.php/ ... d_orders_2

Basically, its good to have all vehicles that logically belong together, i.e. have the same orders (and are of the same type), in one shared order group. This way it's easier to manage. If they currently go A->B and you want to extend them to go A->B->C->B, you only have to adjust the orders of one of the vehicles.
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage

bokkie
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 19 Jan 2007 19:26

Re: PathZilla (v4) - A networking AI

Post by bokkie »

Zutty wrote:
bokkie wrote:Gave your AI a little test, the network it builds is quite cool and should be suitable for cargodest :). Some things I noticed
(..)
4) Is it preferable to transport mail only is towns with pax services too?

You can expect a new version of PathZilla within the next few days, depending on how much real-life work I can avoid doing!
Not really but when a road between cities is already built, adding pax service between the cities as well is pretty cheap and should be profitable as well as there are more passengers generated than mail.

Good luck avoiding real-life! :)

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

Re: PathZilla (v4) - A networking AI

Post by Zuu »

Roujin wrote:
Zutty wrote:[...]
3) What are shared orders? :oops: TBH I'm not actually very skilled at playing OpenTTD! If someone could enlighten me I'd be greatful!
[...]
See here: http://wiki.openttd.org/wiki/index.php/ ... d_orders_2

Basically, its good to have all vehicles that logically belong together, i.e. have the same orders (and are of the same type), in one shared order group. This way it's easier to manage. If they currently go A->B and you want to extend them to go A->B->C->B, you only have to adjust the orders of one of the vehicles.
I'd like to add that shared orders are most useful from players point of view. But still can be useful for an AI. There are API functions for share/unshare but no AIList for getting all vehicles that is in a shared order list. But if you keep a list of all vehicles on a route yourself you can just change the orders of all vehicles almost as quick as without shared orders.

For a player that is quite not true, as he/she need to do lot of manual work to change orders of many vehicles.

So nothing against Roujin or anyone else, but a player noticing that shared orders isn't used is often (my guess) from players perspective where shared orders is something very useful. From AIs perspective it is possible to archive almost the same without shared orders and thus not as important. That said, I use shared orders in my AIs as well as AIVehicle.CloneVehicle() when I need more vehicles on a given route, as my motto in PAXLink has been to store as little as possible metadata in squirrel (currently nothing) and instead gather as much as possible from the API functions. Quite the opposite as for PathZilla with your virtual network.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

bokkie
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 19 Jan 2007 19:26

Re: PathZilla (v4) - A networking AI

Post by bokkie »

isn't shared orders better performance wise (=less CPU intensive)? That's what I thought

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

Re: PathZilla (v4) - A networking AI

Post by Zuu »

bokkie wrote:isn't shared orders better performance wise (=less CPU intensive)? That's what I thought
It is, and more important each order change is a DoCommand. And all operations that result in a DoCommand means that the AI will interrupt until next cycle starts. Usually a program makes about 30 cycles per second. I don't know how much OpenTTD makes, but 30 cycles per second means 30 order changes per second. Yes shared orders will make it faster, but the point is, is it noticeable?

And don't get me wrong. I am not against using shared orders or of using it. It is just that from a players perspective it saves a lot of pain to use shared orders, but from AI writers perspective then it is more the practical benefit of not needing to have to lookup all the vehicle IDs that might be useful. And I think it is fully possible to write a good AI without using shared orders.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v4) - A networking AI

Post by Zutty »

Oh I see. Shared orders wouldn't actually work for me then, as each bus in a service has different orders and they are dynamically updated to balance the load between stations. I suppose I could use them for non-bus routes when I get around to implementing them.
PathZilla - A networking AI - Now with tram support.

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v5) - A networking AI

Post by Zutty »

Hi all,

After an extended break I have finally finished PathZilla v5. This release contains mostly bug fixes and code changes, but I think you'll find some nice new features (read the first post).

To make life easier and to make the AI more robust and flexible I have been working on the innards of PathZilla. The AI now makes more "soft" decisions that give it room to try alternatives, which makes construction in marignal cases (very small towns, rough terrain) more robust. The custom pathfinder that bogged me down for so long has been replaced with the library pathfinder, which instantly fixed a plethora of bugs and made the AI more efficient.

There are also various new pathfinding based features designed to make roads look prettier and function more effectively. The AI can now also demolish town houses to build better road links. One side-effect of this is that local authorities quickly give a PathZilla a low rating, so I have implemented a couple of features to combat this including the construction of a "green-belt" of trees around the town (works surprisingly well).

ARVs support is now implicit as the AI now ONLY builds DTRSs. This can be a bit of a problem if the player does not allow building DTRSs on town roads, making construction in towns a bit awkward and ugly, but I think its a reasonable tradeoff.

I've also finally added fleet size management (something everyone else has had for ages). This further improves profitability for small companies and at very early dates (1800s) with sets like eGRVTS.

Save/load is still fully supported.

If I find the time I plan to implement industry support for v6, amongst other things.

As ever, bug reports and feedback of any kind are very greatfully received.
PathZilla - A networking AI - Now with tram support.

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

Re: PathZilla (v5) - A networking AI

Post by Zuu »

It is very nice to see an update to your very nice AI.

I decided to not just being satisfied by looking on your screenshot, but trying it out also. :) So I started a game with PathZilla and PAXLink. Doing so I found some interesting things that I like to mention. First we can take a look on a screenshot showing an overview between the two first towns that PathZilla tries to connect. (PathZilla is the green company)
PathZilla_town_connect.png
(277.62 KiB) Downloaded 132 times
First PathZilla builds a connection marked as 1) in the screenshot. Then it builds the 2) connection. First I though this was strange, but then I realized after I marked it on the screenshot that this must be because PathZilla see it as two links on its higher level network. So I guess this is perfectly fine.

At the leftmost end of the left connection it fails to connect. It is possible that the depot that is in the way belongs to PAXLink was not there when PathZilla started its computations.


Now moving on to next screenshot:
PathZilla_DTS.png
(669.38 KiB) Downloaded 119 times
After PathZilla built its DTS it seams like it tries to loop the road back to town so that the buses don't need to make an u-turn. However in both a) and b) it fails to do so because there is either a bus station in the way or a town building.

A side note is that PAXLink is quite quick in the beginning of a game as it hardly do any pathfinding. The only pathfinding it does is from its airports in to town, and these paths are usually shorter than in the screenshot above.


Save game attached: (I did not use the PAXLink that is available on bananas, so you might get a md5 error, but it is the same version as last on bananas)
PathZilla.sav
(108.19 KiB) Downloaded 99 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v5) - A networking AI

Post by Zutty »

Thanks for the swift reply Zuu. Very much appreciated.
Zuu wrote:It is very nice to see an update to your very nice AI.
Thanks Zuu :)
Zuu wrote:I decided to not just being satisfied by looking on your screenshot, but trying it out also. :) So I started a game with PathZilla and PAXLink. Doing so I found some interesting things that I like to mention. First we can take a look on a screenshot showing an overview between the two first towns that PathZilla tries to connect. (PathZilla is the green company)
PathZilla_town_connect.png
First PathZilla builds a connection marked as 1) in the screenshot. Then it builds the 2) connection. First I though this was strange, but then I realized after I marked it on the screenshot that this must be because PathZilla see it as two links on its higher level network. So I guess this is perfectly fine.
Yes thats right. The idea is that it might one day want to build a bus service in the middle town so rather than adding extra road at a later date (which might be messy) it adjusts the road in advance.
Zuu wrote:At the leftmost end of the left connection it fails to connect. It is possible that the depot that is in the way belongs to PAXLink was not there when PathZilla started its computations.
Yes it looks like that is what has happened. It SHOULD re-try the route, but there might be something wrong with the way it looks at competitor's property. PathZilla does not work well when it has competition!

I've managed to reproduce this bug on my system to I'll look into it.

Zuu wrote:Now moving on to next screenshot:
PathZilla_DTS.png
After PathZilla built its DTS it seams like it tries to loop the road back to town so that the buses don't need to make an u-turn. However in both a) and b) it fails to do so because there is either a bus station in the way or a town building.
I think a) is because PZ does not attempt to re-path a loop if it fails (it really ought to!), and b) is because the local authority had forbid PZ from demolishing that last house. Note the thick ring of trees around the town - this indicates taht PZ had to battle with the local authority to demolish everything it needed to.
Zuu wrote:A side note is that PAXLink is quite quick in the beginning of a game as it hardly do any pathfinding. The only pathfinding it does is from its airports in to town, and these paths are usually shorter than in the screenshot above.
Yes I noticed that! I tried a few runs agsint Paxlink this morning and it starts like a rocket! PZ really struggled to compete in that first year. The only problem is that it bankrupted itself within 2 years. I played a game in 1990 and Paxlink tried to build lots of International airports, which must have been a big drain on funds.

Zuu wrote:Save game attached: (I did not use the PAXLink that is available on bananas, so you might get a md5 error, but it is the same version as last on bananas)
Oooh, whats coming next for Paxlink? I'll look forward to the next version :)
PathZilla - A networking AI - Now with tram support.

dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: PathZilla (v5) - A networking AI

Post by dbkblk »

Hi,
I've found a small thing. Pathzilla didn't respected his commit since it hasn't built a road following the 3x3 road (OK this is pointless but ...).
I like the idea you had. I think others IAs MUST follow the 3x3 rules when enabled, so this is not a big mess with weird roads everywhere !
Attachments
pathzillapathway.png
(324.62 KiB) Downloaded 104 times

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v5) - A networking AI

Post by Zutty »

dbkblk wrote:Hi,
I've found a small thing. Pathzilla didn't respected his commit since it hasn't built a road following the 3x3 road (OK this is pointless but ...).
I like the idea you had. I think others IAs MUST follow the 3x3 rules when enabled, so this is not a big mess with weird roads everywhere !
Oh dear it shouldn't do that!

Thanks for the bug report dbkblk :) I'll look into it.
PathZilla - A networking AI - Now with tram support.

jui-feng
Engineer
Engineer
Posts: 35
Joined: 01 Feb 2009 15:20
Location: Germany

Re: PathZilla (v5) - A networking AI

Post by jui-feng »

I'm not sure if this is a know bug. I noticed this strange road depot when Pathzilla built it's second route.
Also, it created a lot of bridges when building roads, even when they're not at all necessary, like shown in the screenshot.

I really like this AI. Hope you keep up the good work! :-)
Attachments
Pathzilla, 18. Nov 1986.png
(133.3 KiB) Downloaded 115 times

User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v5) - A networking AI

Post by Zutty »

jui-feng wrote:I'm not sure if this is a know bug. I noticed this strange road depot when Pathzilla built it's second route.
Also, it created a lot of bridges when building roads, even when they're not at all necessary, like shown in the screenshot.

I really like this AI. Hope you keep up the good work! :-)
Thanks for trying it jui-feng. Its always nice to get feedback.

The bridges issue is known and will be fixed in v6. The depot thing is new to me, I'll look into it.
PathZilla - A networking AI - Now with tram support.

dbkblk
Traffic Manager
Traffic Manager
Posts: 154
Joined: 29 Mar 2008 18:38

Re: PathZilla (v5) - A networking AI

Post by dbkblk »

Oops...the RAWR monster crashed again ...
Attachments
pathzillav5crash.png
(302.76 KiB) Downloaded 81 times
pathv5crash.sav
(128.06 KiB) Downloaded 89 times

jui-feng
Engineer
Engineer
Posts: 35
Joined: 01 Feb 2009 15:20
Location: Germany

Re: PathZilla (v5) - A networking AI

Post by jui-feng »

Hi again!

I "played" (watched?) another game. This time, I chose a hilly map and also there's more water than before.

First attempt: Pathzilla calculated a route between a small island and the main island over the span of the first year, before I cancelled it. Maybe it should break or pause the attempt after a certain reasonable time span.

Second attempt: Everything seemed to work nicely, however I noticed a strange behavior: Pathzilla burned a lot of money for "Sonstiges" (engl. misc?), which is pretty much for landscaping only.
I eventually noticed that sometimes the "Sonstiges" budget jumps up by 16k or something like that in a few seconds. At the same time, Pathzilla outputs a "Building road stations in XXX town" message and there are "brown" tiles near the town (see screenshot). Sometimes this repeats a few times, and sometimes Pathzilla succeeds in building stations and everything is okay.

However, sometimes all that (bombing? land raising?) leads to bad authority ratings, so red errors appear.
Attachments
100k spent on &quot;misc&quot;.
100k spent on "misc".
pathzilla-burning-money-1.png (9.24 KiB) Viewed 2355 times
pathzilla-burning-money-2.png
brown tiles, red errors.
(111 KiB) Downloaded 46 times

X_stream
Engineer
Engineer
Posts: 18
Joined: 04 Nov 2004 13:29
Location: Bussum => Netherlands
Contact:

Re: PathZilla (v5) - A networking AI

Post by X_stream »

I think I can help you out on that last error.. if you want to call it one.
PathZilla tends to build trees around towns to boost the ratings
But it seems you play with trees set to transparant, so you only see brown squares where it builds trees.

jui-feng
Engineer
Engineer
Posts: 35
Joined: 01 Feb 2009 15:20
Location: Germany

Re: PathZilla (v5) - A networking AI

Post by jui-feng »

Ah - Yes! That may very well be. However, the trees don't seems to help with the rating, as it's still bad (and no more tree space available ;)).
I wonder why Pathzillas rating is that awful? mh. And how did it burn almost 100k EUR for one city, marking only 20 or so tiles as "brown" (tree)? Last time I checked, trees were only EUR 50 or something. ;)

But yeah. Maybe it's not a bug after all. I'm not sure. ;-)

Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 11 guests