Page 3 of 33

Re: AdmiralAI (v10 out)

Posted: 30 Sep 2008 14:22
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

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 14:49
by CommanderZ
The network on the screenshot was build by the AI? :o Respect :!:

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:02
by Zutty
Cool! Well done Yexo.

As you know I'm interested in networking. I'd like to know more about your approch :)

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:27
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.

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:27
by Ralph
Looks good, having some problems though...

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:32
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?

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:48
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.

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 15:53
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.

Re: AdmiralAI (v10 out)

Posted: 30 Sep 2008 18:55
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)

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 18:59
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?

Re: AdmiralAI (v12 out with train support)

Posted: 30 Sep 2008 19:41
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.

Re: AdmiralAI (v12 out with train support)

Posted: 01 Oct 2008 01:16
by athanasios
Small bug: Depot should be placed in other track, or depot service order in different order.

regards
athanasios

Re: AdmiralAI (v12 out with train support)

Posted: 01 Oct 2008 12:09
by Gremnon
How does the rail part fare with new industries, out of curiosity? Or has no one had a look yet?

Re: AdmiralAI (v12 out with train support)

Posted: 01 Oct 2008 12:24
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.

Re: AdmiralAI (v12 out with train support)

Posted: 01 Oct 2008 12:37
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.

Re: AdmiralAI (v12 out with train support)

Posted: 01 Oct 2008 19:03
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.

Re: AdmiralAI (v12 out with train support)

Posted: 02 Oct 2008 15:36
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 3446 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.

Re: AdmiralAI (v12 out with train support)

Posted: 02 Oct 2008 16:54
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.

Re: AdmiralAI (v10 out)

Posted: 02 Oct 2008 20:28
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.

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

Posted: 02 Oct 2008 21:22
by Zutty
Nice work Yexo (damn you! :P )

How do you find the time to do all this?! :D