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

User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: PathZilla (v6) - A networking AI

Post by SirkoZ »

Zutty wrote:Thanks for all the bug reports everyone. Its nice to see people are still interested in a mouldy old RV-only AI! :D
I'm sure no-one would mind if you included all transport kinds though. ;-)
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v6) - A networking AI

Post by Zutty »

SirkoZ wrote:
Zutty wrote:Thanks for all the bug reports everyone. Its nice to see people are still interested in a mouldy old RV-only AI! :D
I'm sure no-one would mind if you included all transport kinds though. ;-)
I do plan to support all transport types eventually.

Aircraft is next. I'm hoping Yexo will add some NoAI functions to the NewGRF airports branch.

*SUBTLE HINT* :lol:

I also plan to do something a bit clever with airports to handle noise correctly. Not figured it out 100% yet, but watch this space! :D

rait - Thanks for the bug report. Are you Estonian? WOO! Both my house-mates are Estonian. I should have learned the language by now.
PathZilla - A networking AI - Now with tram support.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: PathZilla (v6) - A networking AI

Post by Alberth »

A crash happened:

Code: Select all

dbg: [ai] [1] [S] Your script made an error: top() on a empty array
dbg: [ai] [1] [S]
dbg: [ai] [1] [S] *FUNCTION [Serialize()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/struct/Map.nut line [198]
dbg: [ai] [1] [S] *FUNCTION [Serialize()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/schema/Schema.nut line [257]
dbg: [ai] [1] [S] *FUNCTION [Save()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/main.nut line [222]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [pow()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [55]
dbg: [ai] [1] [S] *FUNCTION [sqrt()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/common.nut line [42]
dbg: [ai] [1] [S] *FUNCTION [GetCircumCircle()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/graph/Triangle.nut line [121]
dbg: [ai] [1] [S] *FUNCTION [constructor()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/graph/Triangle.nut line [41]
dbg: [ai] [1] [S] *FUNCTION [constructor()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/graph/impl/Triangulation.nut line [184]
dbg: [ai] [1] [S] *FUNCTION [Initialise()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/schema/Schema.nut line [230]
dbg: [ai] [1] [S] *FUNCTION [GetPlanGraph()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/schema/Schema.nut line [118]
dbg: [ai] [1] [S] *FUNCTION [FindNewServices()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/service/ServiceManager.nut line [131]
dbg: [ai] [1] [S] *FUNCTION [Start()] ~/.openttd/content_download/ai/PathZilla.6.tar/pathzilla.6/main.nut line [157]
dbg: [ai] [1] [S]
dbg: [ai] [1] [S] [saveData] TABLE
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [data] TABLE
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [@ITERATOR@] 1
dbg: [ai] [1] [S] [schema] INSTANCE
dbg: [ai] [1] [S] [idx] 0
dbg: [ai] [1] [S] [data] TABLE
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 3
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 4
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 5
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 6
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 7
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] [1] [S] [p] 8
dbg: [ai] [1] [S] [num] 2
dbg: [ai] [1] [S] [this] INSTANCE
dbg: [ai] The AI died unexpectedly.
At the time of the crash I just happened to look at what it was doing.

Apparently, it is moving iron ore from the mine to the steel mill using a single station.
I don't think it will get very rich from doing that.
Attachments
a tour around the factory would be nice
a tour around the factory would be nice
rondje_om_de_fabriek.png (76.2 KiB) Viewed 5515 times
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: PathZilla (v6) - A networking AI

Post by Michiel »

Alberth wrote:rondje_om_de_fabriek.png
:D
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: PathZilla (v6) - A networking AI

Post by Dimme »

Zutty wrote: Aircraft is next.
Some thoughts on aircraft income and ideal flight distance on this page (and the following pages):
http://www.tt-forums.net/viewtopic.php? ... &start=540
If you want the matlab files please tell me:)

regards
Dimme
Try my modular airports minigame!

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

Re: PathZilla (v6) - A networking AI

Post by Zutty »

Dimme wrote:
Zutty wrote: Aircraft is next.
Some thoughts on aircraft income and ideal flight distance on this page (and the following pages):
http://www.tt-forums.net/viewtopic.php? ... &start=540
If you want the matlab files please tell me:)

regards
Dimme
Oooh, that looks interesting. Yeah the files would be good. Its been a while since I dealt with M-files, but I think I can remember how to read them!
Alberth wrote:Apparently, it is moving iron ore from the mine to the steel mill using a single station.
I don't think it will get very rich from doing that.
LOL! Thanks for the report Alberth.

I think I have put in a fix so it will at least drop off the cargo for such a service, but I'm going to separate loading and unloading stations at some point to fix this properly.

BTW - I made my first commit in four months last night...

http://code.google.com/p/ottd-noai-path ... tail?r=301

Version 7 is on the way, honest!
PathZilla - A networking AI - Now with tram support.
User avatar
Dimme
Transport Coordinator
Transport Coordinator
Posts: 277
Joined: 30 Jul 2008 12:42
Location: Trondheim, Norway

Re: PathZilla (v6) - A networking AI

Post by Dimme »

Here are the files. They are quite messy and uncommented, so just ask if there is something you don't understand:)
mfiles.zip
balance.m finds which AC is best at a given distance, and how many years it takes to pay down the initial cost. The interesting results are in the best_distance table.
idealdistance.m computes the ideal distance for an AC with certain properties.
(2.6 KiB) Downloaded 128 times
The properties needed to select the best AC includes the loading speed, I don't know whether that is available for AI's.
Try my modular airports minigame!

Image
bokkie
Transport Coordinator
Transport Coordinator
Posts: 327
Joined: 19 Jan 2007 19:26

Re: PathZilla (v6) - A networking AI

Post by bokkie »

Pathzilla crashed on me, screenshot included. Maybe it's the same problem as others reported but better too many bug reports than too few ;)
Attachments
Hoendorade Transport, 1951-07-22.png
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: PathZilla (v6) - A networking AI

Post by Brumi »

PathZilla v6 crashed in my game, see attached screenshot. Poor PathZilla, it was doing well... :)
Attachments
pathzilla crash.png
pathzilla crash.png (28.21 KiB) Viewed 891 times
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v6) - A networking AI

Post by Zutty »

Brumi wrote:PathZilla v6 crashed in my game, see attached screenshot. Poor PathZilla, it was doing well... :)
Thanks for the bug report. This is an interesting one. It seems that there is no possible path between two particular targets (towns/industries). Infortunately I cant tell which two, but NVM.

This might be because...
- The targets are too far apart (2048x2048 map with "very low" towns/industries??)
- The targets have some difficult terrain/obstacles between them and the pathfinder is giving up
- The targets are not connected by land
- Some other bug

Is it at all possible to have a save of this game?
PathZilla - A networking AI - Now with tram support.
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: PathZilla (v6) - A networking AI

Post by Brumi »

Zutty wrote:Is it at all possible to have a save of this game?
Yes, there you go. By the way, the game was first saved way after PathZilla crashed.
Attachments
AI.sav
savegame using r18968
(809.18 KiB) Downloaded 123 times
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: PathZilla (v6) - A networking AI

Post by Brumi »

I haven't seen this type of crash on this thread before, so I'm posting it:
pathzilla crash #2.png
pathzilla crash #2.png (37.75 KiB) Viewed 891 times
The savegame is the same as before, I just loaded it again. I'm using r18968.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v6) - A networking AI

Post by Zutty »

Brumi wrote:I haven't seen this type of crash on this thread before, so I'm posting it:
pathzilla crash #2.png
The savegame is the same as before, I just loaded it again. I'm using r18968.
Another good one. It looks like the AI tried to build a depot directly adjacent to the target tile. Should be simple to reproduce and confirm this.
PathZilla - A networking AI - Now with tram support.
User avatar
ostlandr
Chairman
Chairman
Posts: 882
Joined: 12 May 2007 01:09
Location: Northeastern USA

Re: PathZilla (v6) - A networking AI

Post by ostlandr »

I had an iron mine pop up next to a steel mill in one of my non-AI games recently. I built the ore pickup station on the far side of the mine, and the dropoff station on the far side of the steel mill. Don't know how you'd tell the AI not to build one station in a situation like that, though. Maybe make it so it won't build stations if the cargo produced and the cargo accepted are the same?
Zutty wrote:
Alberth wrote:Apparently, it is moving iron ore from the mine to the steel mill using a single station.
I don't think it will get very rich from doing that.
LOL! Thanks for the report Alberth.

I think I have put in a fix so it will at least drop off the cargo for such a service, but I'm going to separate loading and unloading stations at some point to fix this properly.

BTW - I made my first commit in four months last night...

http://code.google.com/p/ottd-noai-path ... tail?r=301

Version 7 is on the way, honest!
Who is John Galt?
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v6) - A networking AI

Post by Zutty »

I'll just keep a register of which stations are for pickup and which are for dropoff. It can derive everything else from the game state (i.e. what cargo to pick up/drop off). Then when issuing orders the AI may only set a "Load" order at a pikcup station, and only "Unload" at a drop-off station.

Thats the theory anyway!
PathZilla - A networking AI - Now with tram support.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: PathZilla (v6) - A networking AI

Post by Kogut »

crash, no savegame (game running in backgroung for 10 years)
===
Another bug. (The same map, next game)
Attachments
Przechwytywanie.PNG
Przechwytywanie.PNG (49.59 KiB) Viewed 891 times
Przechwytywanie.PNG
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: PathZilla (v6) - A networking AI

Post by planetmaker »

Hi, I just re-loaded my yesterday's AI test game. Seems that Pathzilla didn't like that:

Code: Select all

dbg: [ai] [8] [S] Your script made an error: top() on a empty array
dbg: [ai] [8] [S] 
dbg: [ai] [8] [S] *FUNCTION [Serialize()] /Users/ingo/Documents/OpenTTD/content_download/ai/PathZilla.6.tar/pathzilla.6/struct/Map.nut line [198]
dbg: [ai] [8] [S] *FUNCTION [Serialize()] /Users/ingo/Documents/OpenTTD/content_download/ai/PathZilla.6.tar/pathzilla.6/schema/Schema.nut line [257]
dbg: [ai] [8] [S] *FUNCTION [Save()] /Users/ingo/Documents/OpenTTD/content_download/ai/PathZilla.6.tar/pathzilla.6/main.nut line [222]
dbg: [ai] [8] [S] *FUNCTION [Start()] /Users/ingo/Documents/OpenTTD/content_download/ai/PathZilla.6.tar/pathzilla.6/main.nut line [168]
dbg: [ai] [8] [S] 
dbg: [ai] [8] [S] [saveData] TABLE
dbg: [ai] [8] [S] [this] INSTANCE
dbg: [ai] [8] [S] [data] TABLE
dbg: [ai] [8] [S] [this] INSTANCE
dbg: [ai] [8] [S] [@ITERATOR@] 1
dbg: [ai] [8] [S] [schema] INSTANCE
dbg: [ai] [8] [S] [idx] 0
dbg: [ai] [8] [S] [data] TABLE
dbg: [ai] [8] [S] [this] INSTANCE
dbg: [ai] [8] [S] [expansionInterval] 600
dbg: [ai] [8] [S] [maintenanceInterval] 400
dbg: [ai] [8] [S] [workInterval] 200
dbg: [ai] [8] [S] [latency] 1
dbg: [ai] [8] [S] [noServices] false
dbg: [ai] [8] [S] [ticker] 400
dbg: [ai] [8] [S] [this] INSTANCE
dbg: [ai] The AI died unexpectedly.
Before re-loading the game it survived; generally it seems like it could try to improve its station rating a bit. In any case, keep up the good work :-)
Attachments
Neu Hahnmünster Transport, 04-04-1989#1.png
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: PathZilla (v6) - A networking AI

Post by Zutty »

Thanks for the reports Kogut & planetmaker. Both are known bugs that will be fixed in the next version.

Just to tease, and so you all know I'm still working on this, heres a nice new feature for you: naming schemes...
Not much to see, but the company name was generated!
Not much to see, but the company name was generated!
pz_naming.png (48.02 KiB) Viewed 5042 times
The AI has a set of naming 'schemes', each of which can generate an extremely broad pool of names, with the intention being that no player should ever see the same name twice (ever). I will include four naming schemes with version 7....
  • A simple scheme that just names everything "<home town> Transport"
  • A more complex scheme to generate non-country specific english-language names
  • One for British sounding names
  • One for American sounding names
The names are mostly based on the current game state. The town that the AI is based in, the name of the company president, the current year, etc... If you're interested to see how it works, or just to see what kinds of names you can expect, here is the British scheme...

http://code.google.com/p/ottd-noai-path ... ritish.nut

I am very much hoping that people will be able to provide me with translations so that I can provide more international naming schemes as time goes on (French, German, Dutch, etc...). Plus, I plan to make this even cooler with a future update, but I'll keep quiet for now!

Hope you find this interesting. :D
PathZilla - A networking AI - Now with tram support.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: PathZilla (v6) - A networking AI

Post by Zuu »

Interesting. If you feel like sharing you could turn that into a library. Though, I'm unsure as of if I would use it. CluelessPlus already has a name-sheme (not as complex as yours though) and PAXLink would need and adopted scheme for its kind of service. That said the transport companies IRL always seems to come up with interesting names when they re-brand.

I saw that you had an empty string animal:

Code: Select all

animal = ["Rabbit", "Swallow", "Kestrel", "Fox", "Pony", "Peacock", "Viper", ""]
Not sure if that is intended or not.
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 (v6) - A networking AI

Post by Zutty »

Woops! Thanks Zuu.

If people are interested then I could try to make a library out of it, as it is quite flexible. I'm open to suggestions on how to improve it too, particularly when it comes to internationalisation. I'm thinking I should broaden the scope of this thing to serve up ALL strings that the AI shows to the user, but I'm still thinking of a clean way to do this.

Yexo (or other devs) - Can an AI library expose more than one class via the import() statement, or would I have to use an inner class, such as...

Code: Select all

class NamingScheme {
  class Pattern { ... }
}
PathZilla - A networking AI - Now with tram support.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 8 guests