Testing several AIs that use trains

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

Post Reply
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Testing several AIs that use trains

Post by Samu »

I conducted 3 games with several AIs using only trains by disabling road vehicles, ships and aircraft.

The AIs used were:
- NoCAB v495
- Denver & Rio Grande v1
- ChooChoo v361
- trAIns v2
- AdmiralAI v25
- SimpleAI v5

OpenTTD version is 1.0.4

I came to a clear conclusion who the worst was, and it's NoCAB. In these 3 games, it was only able to build trains in 1 of them. In that game I saw it attempting a second station, it even started building the rails but ended up with no money to finish it so it removed the lines. It did this several times in vain, as it was wasting all its little money for nothing. Only 15 years later it was finally able to build a second train route, having a total of 6 trains, while the company with most trains already had 140, and the company with the most value already had 45.

I'd say for second worst it's ChooChoo, mainly because it cheats with bus stations, but also because it waits an eternity for money. It's very random, if ChooChoo gets a good start then it will develop fast enough, the waiting for money will be minimal, but if it doesn't, it becomes a pretty slow going AI. I think the main problem are bridges, it takes most of it's money, sometimes it builds bridges a height higher than usual for nothing.

Denver & Rio Grande is quite complicated, it needs fine tunning in its settings to be able to build something and prosper in an environment with other AIs. It finally developed in the 3rd game beyond 10 trains and it's one of the best.

The others 3 are winners, but they're all different so I can't really conclude who's the definite winner. If we're talking about most trains, then it's SimpleAI, however SimpleAI has the weirdest pathfinding, it constructs randomly, as long as it's able to connect 2 stations, it's fine. But if we're talking about the look, then trAIns is the best. It is also the one that has the most company value and best looking networks. on the contraire, AdmiralAI has the most complicated network for the human eye, but despite that, it is an efficient AI with lots of profit.
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: Testing several AIs that use trains

Post by Samu »

Sem nome, 2016-05-30.png
(60.2 KiB) Downloaded 5 times
Still running the 3rd game, I can notice some issues with some of the AIs.

AIs with bridge upgrading:
- SimpleAI (replaces existing bridges as soon as a faster bridge is available)
- AdmiralAI (doesn't replace existing bridges, only when building new routes)
- trAIns (doesn't replace existing bridges, only when building new routes)
- ChooChoo (doesn't replace existing bridges, only when building new routes)
- Denver & Rio Grande (doesn't replace existing bridges, unknown as of yet when building new routes)

AIs with engine model upgrading:
- trAIns (replaces running models as well as rail type as soon as a newer profitable model is available)
- SimpleAI (when replacing old aged vehicles and when building new routes)
- Denver & Rio Grande (when replacing old aged vehicles and when building new routes)
- AdmiralAI (only when previous used model is no longer available and when building new routes)
- ChooChoo (does't replace non-existing model, keeps old aged model, but builds new models on new routes)
Attachments
Sem nome, 2016-06-11.sav
(582.83 KiB) Downloaded 122 times
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: Testing several AIs that use trains

Post by Brumi »

Samu wrote:- AdmiralAI (only when previous used model is no longer available and when building new routes)
That one is interesting. In my games (starting in 1950 with the default train set) AdmiralAI gradually replaces its older engines to the Manley-Morel DMU when it becomes available. Not the optimal choice though :D
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Testing several AIs that use trains

Post by Yexo »

Brumi wrote:
Samu wrote:- AdmiralAI (only when previous used model is no longer available and when building new routes)
That one is interesting. In my games (starting in 1950 with the default train set) AdmiralAI gradually replaces its older engines to the Manley-Morel DMU when it becomes available. Not the optimal choice though :D
That is also how I coded it :p. Samu: if you can reproduce the problem that is doesn't replace the engines until a newer one comes available: can you upload a savegame?
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: Testing several AIs that use trains

Post by Samu »

I started the game in 1985, it picked SH '125'. 20 years later, it replaces these engines with the same SH '125' though it could have picked 'AsiaStar'. The reliability isn't that good anymore, you know.
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Testing several AIs that use trains

Post by Yexo »

Ah, but that is a different issue. For some reason AdmiralAI thinks the SH '125' is better than the AsiaStar. IIRC it doesn't take the reliability into account at all. Another reason might be that it had trouble updating the line to electric rail.
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: Testing several AIs that use trains

Post by Samu »

Train Jam and old trains not being replaced at all.
AdmiralAI.
Attachments
Sem nome, 2049-10-28.sav
(469.06 KiB) Downloaded 135 times
Morloth
Transport Coordinator
Transport Coordinator
Posts: 378
Joined: 07 Feb 2008 14:06
Location: Glasgow

Re: Testing several AIs that use trains

Post by Morloth »

Hi Samu,

Thanks for testing, I've been inactive on these forums and with NoCAB for quite some time now so I did not notice that a change in the rail code broke the train building part of my AI. The new version 2.1.2 should work as it did before, so please try it one more time before writing it off. Thanks :).

Bram
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: Testing several AIs that use trains

Post by Michiel »

Samu wrote:I'd say for second worst it's ChooChoo, mainly because it cheats with bus stations, but also because it waits an eternity for money. It's very random, if ChooChoo gets a good start then it will develop fast enough, the waiting for money will be minimal, but if it doesn't, it becomes a pretty slow going AI. I think the main problem are bridges, it takes most of it's money, sometimes it builds bridges a height higher than usual for nothing.
Hi Samu, thanks for the test!

I wish I was better at understanding how the pathfinder works. I have no idea why it sometimes decides to build bridges where they're not needed. I can increase the A* cost for them, of course, but then it'd fail to find a path more often. Alternatively, I can reduce the pathfinder speed for a more optimal route, and have it sit there for months calculating, which is boring as heck to watch, so I'm afraid the bridges will stay. Are you sure that's it, though? Unless you're playing with increased building costs, bridges are only a couple thousand pounds (IIRC) and the main cost is in buying locomotives.

I'm not sure what to do with ChooChoo - I could make it generate lots of profit by just spamming the map with point-to-point cargo lines, but that's cheap and ugly. I could make it choose optimal industries, but then it'd look silly if you start several ChooChoos and they all sit in the same spot. If it doesn't "cheat" with bus stations, it's almost impossible to play on mountainous maps, because you can rarely build close enough to the city center to get decent coverage without risking bankruptcy by massive terraforming, especially if you try to hook up small towns as well.

It's the same with the waiting for money thing; either you risk bankruptcy on the hard maps, or go too slow on easy maps. Maybe I should give it a "recklessness" parameter, making it more willing to spend money it's keeping back for when the game checks for bankruptcy.

If you want it to be more aggressive, you can increase the "number of point to point lines to build at the start". If you raise that to, say, 20 (or whatever maximum I set), it'll make a mess of the map but it should go a lot quicker. A larger starting loan also helps a lot, of course. What game settings did you use, btw?

All in all, I'm not sure where to sit on the spectrum of profit vs. aesthetics, and since most AIs go for profit, I'm sticking closer to the other end, capitalism be damned :P
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: Testing several AIs that use trains

Post by Samu »

I wish I was better at understanding how the pathfinder works. I have no idea why it sometimes decides to build bridges where they're not needed.
No, that's not what I mean, the bridge is really needed. It happens on slopes that take 2 squares, the AI starts the bridge on the first square instead of starting it on the second square. This raises the height for the bridge by 1 where it's not needed should it had started on the second square.

EDIT: Actually, the pathfinder is right, just tested myself building a bridge on the first square, it's 2 times as cheap than building it on the second square. Makes no sense. Aesthetically speaking, it looks ugly but it's cheaper.
Attachments
Sem nome, 25 Jul 2016.png
(110.62 KiB) Downloaded 4 times
Samu
Traffic Manager
Traffic Manager
Posts: 236
Joined: 17 Apr 2007 14:28

Re: Testing several AIs that use trains

Post by Samu »

OMG, look at this from SimpleAI.
Attachments
Sem nome, 1982-07-17.png
(255.85 KiB) Downloaded 2 times
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: Testing several AIs that use trains

Post by Michiel »

Samu wrote:
I wish I was better at understanding how the pathfinder works. I have no idea why it sometimes decides to build bridges where they're not needed.
No, that's not what I mean, the bridge is really needed. It happens on slopes that take 2 squares, the AI starts the bridge on the first square instead of starting it on the second square. This raises the height for the bridge by 1 where it's not needed should it had started on the second square.

EDIT: Actually, the pathfinder is right, just tested myself building a bridge on the first square, it's 2 times as cheap than building it on the second square. Makes no sense. Aesthetically speaking, it looks ugly but it's cheaper.
I think it may be because building on coastal tiles is more expensive than bridging over them (though the pathfinder doesn't look at "dollar costs" - but the pathfinder costs for slope + coast + bridge may be more than just the longer bridge). Thanks for checking and grabbing a screenshot btw :)
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: peter1138 and 13 guests