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
Captain Rand
Traffic Manager
Traffic Manager
Posts: 192
Joined: 28 Jan 2012 07:35

Re: ChooChoo, a train network AI

Post by Captain Rand »

Michiel wrote: 04 Mar 2024 20:47 By popular request (hi Pete!) ChooChoo now also supports left hand traffic on double tracks!...........
This is awesome!
Thank you so much!

Pete.
There's nothing like a deadline to hone the concentration.

Good manners cost nothing, but earn respect.

" 'Impossible' is not in our vocabulary." Jack Chrichton, Farscape
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Michiel wrote: 25 May 2010 20:29 It should really have a lake detector... the pathfinder is still slow when it tries to find a route across or around a large body of water. Never mind, just thinking out loud :) It's fun giving it infinite money and watching it spew forth all over the map :)
It's taken almost 14 years, but today I added... a lake detector! :shock: :shock: :shock:

It's dead simple really, but the idea only came to me the other night. Consider the following mockup:
lake-detector-small.png
lake-detector-small.png (519.04 KiB) Viewed 1632 times
When trying to find a spot for a station, it'll look at the four edges of the rectangle defined by the start (crossing exit) and destination (station entrance). It checks the tiles along each edge and if it finds a long run of water (longer than the maximum bridge length it is allowed to use) it considers that edge "blocked by water". However, it will only consider this problematic if two parallel edges are blocked. In that case, it will declare it an unviable spot for a station, and look elsewhere.

This may lead to some missed opportunities (there might be a perfectly fine bit of land in between the edges), but that's fine - the network building algorithm tends to sprawl its tendrils across the map anyway. It's much better than ChooChoo sitting there, pathfinding for 20 years.

I still need to do some more testing and tweaking, but expect another release soon :D
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

New version with lake detector released!
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Another update! After the initial concept, I never gave ChooChoo's expansion algorithm much thought. But I've now changed it so that for each crossing it is extending, it'll keep going in the same direction as far as it can (if it can place an additional crossing between its current position and the next station). Expansion of the side branches is put at the end of its task list. That should result in deeper networks with much better use of space, with mainlines extending across the map and side branches filling the remaining space, like the veins of a leaf.
leaf.png
leaf.png (673.52 KiB) Viewed 1507 times
Of course, this structure is greatly perturbed by the randomness of the actual map.
choochoo-network-anim.gif
choochoo-network-anim.gif (92.5 KiB) Viewed 1515 times
Attachments
choochoo-network.gif
(121.33 KiB) Not downloaded yet
xarick
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 26 Feb 2015 00:52

Re: ChooChoo, a train network AI

Post by xarick »

Something's not right.
Attachments
Unnamed, 1949-12-01.png
(72.3 KiB) Not downloaded yet
Unnamed, 1949-12-07.png
(70.37 KiB) Not downloaded yet
Unnamed, 1949-12-07.sav
(17.81 MiB) Downloaded 28 times
Formerly known as Samu
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

Thanks, I'll take a look!
User avatar
Michiel
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 13 Jul 2008 00:57
Contact:

Re: ChooChoo, a train network AI

Post by Michiel »

xarick wrote: 15 Mar 2024 21:46 Something's not right.
Unfortunately I was unable to deduce the problem from your screenshots or savegame. For the next version, I've improved the code that captures the error, so I'll be able to get the info I need from a screenshot, but I have some testing to do for the next release.
xarick
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 26 Feb 2015 00:52

Re: ChooChoo, a train network AI

Post by xarick »

Is this more helpful? Seems to happen when creating a new network. Sometimes it happens early on, sometimes takes some years before it happens.
Attachments
Unnamed, 1965-09-15.png
(261.2 KiB) Not downloaded yet
Formerly known as Samu
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 15 guests