ChooChoo, a train network 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
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Rubidium wrote:
Michiel wrote:Devs: is there a way to make it available in Bananas for both 0.7.2 and nightlies?
If you set minimum version to 0.7.2 and no maximum version it should work.
Then it tells me "invalid value" :-/
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: ChooChoo, a train network AI

Post by Zuu »

I think you need to remember to select "no limit" or something similar in the drop-down list rather than just not putting anything in the edit box.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: ChooChoo, a train network AI

Post by Wasila »

I started ChooChoo roughly twenty playing years (I time cheated) into my game, and I got an error almost immediately. Screenshot attached.
Attachments
GlobalTrans, 25th Oct 1937.png
(28.17 KiB) Downloaded 137 times
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Oh, that's fine, actually. It's just trying to find two towns to connect. Because it doesn't do terraforming for stations (yet), it can take a couple of tries before it finds a suitable pair of towns. In the meantime, it'll retry (which it does by throwing an exception, which is the source of the red output).
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: ChooChoo, a train network AI

Post by Wasila »

It does seem to have finally planted a seed, but I think its already built some lines outside of the main network. Is that normal?
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Yup, it starts off with 3 single track, point to point lines to generate some initial income. Then, it'll start building networks. Eventually, I want it to clean up the simple lines once it gets enough income from its "real" tracks.

By the way, what's the maximum loan set to? It can usually get off the ground on 100k, but a bigger loan will make it start a lot quicker.
Kerygma
Engineer
Engineer
Posts: 14
Joined: 30 Jun 2009 11:06
Location: Germany

Re: ChooChoo, a train network AI

Post by Kerygma »

The bug with too long NewGRF trains is still present. Not sure if you already tried to fix it ;)
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: ChooChoo, a train network AI

Post by Wasila »

Max loan is set to 500k ;). As for the main network, it unfortunately built a junction in a very bad place, so it may have to start the second network already. How fast does it usually build?

Also has the AI been designed for the 2cc set? It seems to be using just metro trains as opposed to steam ones. No real problem, just wondering.
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Kerygma wrote:The bug with too long NewGRF trains is still present. Not sure if you already tried to fix it ;)
Nope, I've got bigger ones to fix first :p Broken tracks, and such. I think I can fix the train length bug in the next release, though.
Wasila wrote:Max loan is set to 500k ;). As for the main network, it unfortunately built a junction in a very bad place, so it may have to start the second network already. How fast does it usually build?
Once the initial three lines are in place, as fast as it can :) If it has money to spend, it'll be building or pathfinding. When nothing is happening, it's usually waiting for money to buy trains, which are the most expensive part of expansion. If you're using 2cc, they're even more expensive. The debug window should give a hint as to what it's doing, but it's not very user friendly. I'm thinking of making it place optional "this is what I'm currently working on" signs. "Expanding this crossing", "buying train for service from X to Y", that sort of thing.
Wasila wrote:Also has the AI been designed for the 2cc set? It seems to be using just metro trains as opposed to steam ones. No real problem, just wondering.
No, I don't use any newgrfs myself and I'm not really going to support specific sets. 2cc uses monorail as metro trains, right? Unfortunately, there's no easy way to tell that this is the case. I just take the newest rail type available, which in a normal game progresses through regular, electrified, monorail and then maglev as engines become available, and "newer is better" generally holds when it comes to buying locomotives. If 2cc introduces monorail in 1850, well, then that's what it'll use :) Maybe I'll add a more sophisticated train selection algorithm, which can then be used to pick the most appropriate rail type. Not anytime soon, though :p
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: ChooChoo, a train network AI

Post by Wasila »

The game does use metro tracks, which do still make money.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: ChooChoo, a train network AI

Post by Wasila »

Attached is a crazy loop worthy of the original AI. You can also just about see my much shorter (and saner) route between the same cities.
Attachments
GlobalTrans, 13th Oct 1951.png
(127.33 KiB) Downloaded 147 times
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Haha, that is pretty crazy. It doesn't check distance travelled vs. distance as-the-crow-flies at all; if it turns out the trains are running at a loss, they'll just be sold.
User avatar
Dustin
Transport Coordinator
Transport Coordinator
Posts: 272
Joined: 07 Dec 2005 19:22

Re: ChooChoo, a train network AI

Post by Dustin »

Wasila wrote:Attached is a crazy loop worthy of the original AI. You can also just about see my much shorter (and saner) route between the same cities.
Having wrote my own pathfinder, I could go into detail as to why that probably happens. Lets just say that I bet ChooChoo doesn't waste too much time pondering "perfect" when it can get to "good enough" in a hurry. Time is money, and pathfinding is where the AI's spend the majority of thier time. Choo Choo has a neat solution by only making major runs along the axis. You can always build rail in the direction. DR&G could use some of that kind of thinking on hilly maps.
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Dustin wrote:Having wrote my own pathfinder, I could go into detail as to why that probably happens. Lets just say that I bet ChooChoo doesn't waste too much time pondering "perfect" when it can get to "good enough" in a hurry.
Exactly so :)
Also, it doesn't actually connect cities - it just expands its current network, adding trains to newly connected stations. If a network ends up connecting only two cities, you may end up with something like that, but connecting those cities was never an explicit goal.
User avatar
1009
Engineer
Engineer
Posts: 81
Joined: 22 Mar 2009 07:24
Location: Haarlem, The Netherlands
Contact:

Re: ChooChoo, a train network AI

Post by 1009 »

I wanted to share this gem with you:
From A to Z to B.
From A to Z to B.
AZB.png (57.97 KiB) Viewed 6160 times
Besides, you should test ChooChoo with 2CC. It works just as 2CC intended, starts building metro tracks right away between cities =P looks very cool.
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

LOL, that's a nice knot :D
Wold
Transport Coordinator
Transport Coordinator
Posts: 318
Joined: 03 Aug 2006 19:32
Skype: woldy_bg
Location: Bulgaria

Re: ChooChoo, a train network AI

Post by Wold »

Well the AI sort of stopped working for me -
ChooChoo #2.png
ChooChoo #2.png (53.43 KiB) Viewed 2967 times

And when it works it fails like this:
ChooChoo #1.png
ChooChoo #1.png (46.9 KiB) Viewed 2968 times
Image
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

The first one is really weird - there's no signals on the track. The second one looks familiar, I think that's the bug I've been working on. I continue to blame Dwarf Fortress for the lack of progress ;)
User avatar
1009
Engineer
Engineer
Posts: 81
Joined: 22 Mar 2009 07:24
Location: Haarlem, The Netherlands
Contact:

Re: ChooChoo, a train network AI

Post by 1009 »

Michiel wrote:The first one is really weird - there's no signals on the track. The second one looks familiar, I think that's the bug I've been working on. I continue to blame Dwarf Fortress for the lack of progress ;)
The first one is just one of its initial three money generating connections? It doesn't put signals on those, so.
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

:oops:

Durr... thanks for pointing that out *facepalm*
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 8 guests