AdmiralAI v25

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: AdmiralAI (v10 out)

Post by Yexo »

I proudly present: AdmiralAI v12. You'll need NoAI r14418 or newer. Tar files is in the first post.

New features:
  • Train support (only cargo routes for now)
  • The .nut files are now separated in the directories air, rail and road to keep the structure clear.
  • Speed up pathfinding by +- 20% (for road and rail)
Bug fixes:
  • Don't flattan land for an airport if it can't be build anyway because the town will refuse. (noise limit or max 2 airports per town limit)
  • After pathfinding, first try building the whole route (as the map might have changed while pathfinding) to prevent half-failed routes.
Thx to xyz for testing it and reporting several bugs and some ideas. As always: all comments and bug reports are welcome.

Plans for future versions:
  1. Support for drive-though stops
  2. Support from trams (needs 1.)
  3. Build a train network for passengers (wip: screenshot screenshot 2)
Since noai r14391 it is possible to set AI settings via start_ai. Use "start_ai [ainame] [settings]" for that. For AdmiralAI, the available settings are:
  • use_busses=0/1
  • use_trucks=0/1
  • use_planes=0/1
  • use_trains=0/1
  • build_statues=0/1
  • always_autorenew=0/1
Default values are 1 for all but always_autorenew.

So to run AdmiralAI with trains only, you use:
start_ai admiralai use_trucks=0,use_busses=0,use_planes=0
User avatar
CommanderZ
Tycoon
Tycoon
Posts: 1872
Joined: 07 Apr 2008 18:29
Location: Czech Republic
Contact:

Re: AdmiralAI (v12 out with train support)

Post by CommanderZ »

The network on the screenshot was build by the AI? :o Respect :!:
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v12 out with train support)

Post by Zutty »

Cool! Well done Yexo.

As you know I'm interested in networking. I'd like to know more about your approch :)
PathZilla - A networking AI - Now with tram support.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Yes, that network was completely build by a branch of AdmiralAI, but not the version you can download here.

I took a look at your delaunay triangulation code, but I found it too slow especially on bigger maps with a lot of towns (try 2048^2 with high towns). I currently use the follow strategy:
1. Only use the top 1/3 biggest towns. This value maybe needs adjusting dependend on the total amount of towns / map size, but for now it's a good estimate.
2. For every town in this list, get the 3 nearest neighbours in all directions (N, E, S, W), and evaluate the connection between them. For the evaluation, get all neighbouring towns, and disallow the connection if it is the long side of a triangle with a big angle, allow it otherwise.

With this algorithm I can plan a network on 2048^2 with high towns in about 5 game days. Creating all signals so I can view the networks takes way longer of course. FYI, the screenshots shown above where created less than 5 years after the start of the game and all planned connections are build.

Besides this, I created several functions to cluster nearby towns, but those are currently not in use. I might run this clustering first and connect all clusters instead of only big cities.

@zutty: I'll clean up my network building code and send it to you.
User avatar
Ralph
Engineer
Engineer
Posts: 87
Joined: 21 Jun 2004 15:25

Re: AdmiralAI (v12 out with train support)

Post by Ralph »

Looks good, having some problems though...
Attachments
problem.jpg
(1.03 MiB) Downloaded 246 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Ralph wrote:Looks good, having some problems though...
That error is because:
Yexo wrote:...You'll need NoAI r14418 or newer...
It shouldn't build the rail as it did, can you send me the savegame?
User avatar
Ralph
Engineer
Engineer
Posts: 87
Joined: 21 Jun 2004 15:25

Re: AdmiralAI (v12 out with train support)

Post by Ralph »

Might be nice if releases ran on the binary posted on the website (14400, but it is 5 days old for some reason?).

I don't have the save file for that screenshot, but have a similar one.
Attachments
Unnamed, 1st Jan 1951.sav
(95.3 KiB) Downloaded 135 times
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Ralph wrote:Might be nice if releases ran on the binary posted on the website (14400, but it is 5 days old for some reason?).

I don't have the save file for that screenshot, but have a similar one.
14400 was the last change in the noai branch before 14418. In a few hours a new binary (14418) will be available. The alternative for me was to wait a untill tonight to release it, but I didn't see a point in that.

Thanks for the savegame, I'll have a look.
Edit: openttd asserts when trying to restart that savegame, so I can't replay the building. I'll do more testing myself to see if I can reproduce it.
MasterNnja
Engineer
Engineer
Posts: 64
Joined: 14 Sep 2008 16:01

Re: AdmiralAI (v10 out)

Post by MasterNnja »

Yexo wrote:I proudly present: AdmiralAI v12. [...]
New features:
  • Train support (only cargo routes for now)
Hey, this was faster than expected. Also I expected the first train AI would be an AI which exclusively uses trains. Nice to see there is already an AI which handles (almost) all verhicle types.

This would mean, I'll install the NoAI-Version of OpenTTD 8)
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: AdmiralAI (v12 out with train support)

Post by Hyronymus »

This is very nice to see, the networks created are almost human. How's the profit on the networks created by the AI though?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Hyronymus wrote:This is very nice to see, the networks created are almost human. How's the profit on the networks created by the AI though?
The networks as shown in the screenshots are build by a branch of admiralai, which isn't available yet, as no trains are build. The goal is to extend that network with bus / tram routes, so the AI will be able to play cargodest. That'll have to wait till cargodest hits trunk. In the meantime I'm planning to do some more network building for cargo, ie use trucks to tranfer coal to a central train station, and transport it a longer distance from there.
User avatar
athanasios
Tycoon
Tycoon
Posts: 3138
Joined: 23 Jun 2005 00:09
Contact:

Re: AdmiralAI (v12 out with train support)

Post by athanasios »

Small bug: Depot should be placed in other track, or depot service order in different order.

regards
athanasios
Attachments
depot_placement.png
depot_placement.png (50.03 KiB) Viewed 5844 times
http://members.fortunecity.com/gamesart
"If no one is a fool I am also a fool." -The TTD maniac.


I prefer to be contacted through PMs. Thanks.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: AdmiralAI (v12 out with train support)

Post by Gremnon »

How does the rail part fare with new industries, out of curiosity? Or has no one had a look yet?
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Gremnon wrote:How does the rail part fare with new industries, out of curiosity? Or has no one had a look yet?
New industries as in built / prospected industries or new industries as in ecs vectors / pbi? The first work fine, the second will mostly work, just like it does for trucks. That is, new industries work fine, as long as they don't stop accepting cargo because the stockpile is full.
User avatar
Gremnon
Tycoon
Tycoon
Posts: 1517
Joined: 16 Sep 2005 12:23
Skype: the_gremnon
Location: /home
Contact:

Re: AdmiralAI (v12 out with train support)

Post by Gremnon »

Heh, that clears up the other question I was going to ask nicely... thanks, I think I'll give myself a challenge and try to beat AdmiralAI for a bit.
User avatar
SirkoZ
Tycoon
Tycoon
Posts: 1518
Joined: 06 Mar 2004 23:51
Location: The sunny side of Alps

Re: AdmiralAI (v12 out with train support)

Post by SirkoZ »

Just a quick thank you, Yexo - I played a game yesterday with the v12 of your great AdmiralAI (as soon as I saw it's got rail in it) and I'm quite pleasantly surprised at the AI rail formations, quite sufficient for competition cases. I think I'll change my building style in competition games. :-)

BTW - here's the savegame of the game - I used the default economy and my Oil_wells_don't_only_decrease newGRF.
Attachments
SuperR_AI_L_-_r14418-noai, 28th Jan 2051.sav
savegame
(207.41 KiB) Downloaded 127 times
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v12 out with train support)

Post by Zutty »

Hi Yexo,

I think I may have found a bug. This screenshot shows AdmiralAI building a tram line to carry coal. There were no other AIs running. This is in r14425.
AdmiralAI building tram lines for coal
AdmiralAI building tram lines for coal
admiralai-bug.png (130.8 KiB) Viewed 1596 times
Is it possible that the current road type is persistent, i.e. that is is stored between ending one game and starting another? The last thing my AI was doing was building tram routes, but that was in the previous game.

I hope this is of some help to you.
Attachments
admiralai-bug-r14425.sav
(112.4 KiB) Downloaded 123 times
PathZilla - A networking AI - Now with tram support.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v12 out with train support)

Post by Yexo »

Zutty wrote:Is it possible that the current road type is persistent, i.e. that is is stored between ending one game and starting another? The last thing my AI was doing was building tram routes, but that was in the previous game.
A simple test ai confirmed this, so this is a bug in the api, not in admiralai. Still thx for reporting it.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: AdmiralAI (v10 out)

Post by Yexo »

I now present: AdmiralAI v13. Although this version is the first with tram support, it is mostly a bugfix release. You'll need NoAI r14418 or newer. Tar file is in the first post.

New features:
  • Drivethrough road stop support for passenger routes
  • Tram support (only passenger routes). Currently every time a bus route is created, a random choice between busses and trams is made.
Bug fixes:
  • Rail stations were sometimes shortened to 3 tiles, causing deadlocks
  • Never build level crossings as these can cause deadlocks near stations.
  • Fix an bug in the handling of autoreplace where bus stops could be flooded with way too many vehicles.
  • Don't even try to start building rail routes as long as normal rail is not available.
  • Try to build a depot in both directions, and insert the service at depot order in the correct position
  • Building the track in front of a rail station could fail for various reasons: fix slopes if they are not correct and reserve enough room.
Known bugs:
  • If a multihead engine becomes available, AdmiralAI will start autoreplace with to that engine, but atm there is no api function to automatically remove some attached wagons so the train doesn't become too long. This can cause deadlocks.
  • Incompatible with DBSet because the AI tries to attach a wagon to an engine but this grf prevents that.
  • Only normal rail is supported, the network is never upgraded to another rail type.
  • Pathfinding (especially rail pathfinding) sometimes takes a very long time, during which no new vehicles are bought / unprofitable vehicles are sold.
Thanks to everyone who reported bugs so I could fix them.
User avatar
Zutty
Director
Director
Posts: 565
Joined: 22 Jan 2008 16:33

Re: AdmiralAI (v13 out): busses, trucks, trams, trains, planes

Post by Zutty »

Nice work Yexo (damn you! :P )

How do you find the time to do all this?! :D
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 50 guests