Page 19 of 20

Re: ChooChoo, a train network AI

Posted: 24 Mar 2023 10:39
by Michiel
Thank you! I already stole some of the best bits :wink: I'll probably make a new release in a few days.

Re: ChooChoo, a train network AI

Posted: 26 Mar 2023 19:30
by Michiel
New version! An actual update and not just a bug fix this time 8o

The big red cantilever bridges ChooChoo was fond of building (because they are the fastest available at many lengths) have always been an eyesore to me. Now, I've changed the bridge selection to improve aesthetics: it prefers shorter bridges, so it's more often able to use the nice compact steel girders, and for longer bridges it now defaults to the nice coppery suspension bridges. They're slower, but who cares, it's all about looks! :D I've also taught the pathfinder how to combine non-crossing track pieces, so double track lines can now be built tighter and neater by allowing the second track to share a tile with the first track, as long as they don't cross, as you can see at the north exit of the Penfingford Point junction. It also means that if it manages to find the first path, it's much more likely it'll be able to fit in the second track.
bridges-squeeze-cropped.png
bridges-squeeze-cropped.png (771.23 KiB) Viewed 9682 times
bridges3-after.png
bridges3-after.png (701.12 KiB) Viewed 9682 times
Snake like a snaky snake!
snake.png
snake.png (1.43 MiB) Viewed 9681 times

Re: ChooChoo, a train network AI

Posted: 30 Mar 2023 08:16
by Michiel
Another update: nothing to screenshot, but a major improvement in pathfinder performance, so ChooChoo should now be a lot more active. On my "torture test" map, finding a path dropped from 14 years to less than 2.

Fellow AI devs, if there is interest I can see if I can make some of the improvements available in the library pathfinder. The big one is removing the self-intersection test from aystar, which I don't need but could be made optional in the general purpose library implementation. The rest are various smaller improvements:
  • using AIBinaryQueue
  • caching cost estimates per tile (since they don't depend on direction)
  • caching base costs per tile (costs independent of how you enter/leave the tile)
  • shaving off a few ops by doing cheaper tests first in conditionals, pulling expressions out into local variables, etc.

Re: ChooChoo, a train network AI

Posted: 31 May 2023 07:21
by Redirect Left
Hi there! Your AI struggled in tests for the AI list update for June. It created trains endlessly, until it jammed itself up. It now seems to be unable to correct the issue on this line by itself.

I've attached an image of the issue, and the savegame file.

Re: ChooChoo, a train network AI

Posted: 31 May 2023 12:32
by Michiel
Its train management is quite limited, but that's not supposed to happen :) I'll see if I can glean anything from the savegame, thanks for posting!

Re: ChooChoo, a train network AI

Posted: 31 May 2023 12:44
by Redirect Left
Michiel wrote: 31 May 2023 12:32 Its train management is quite limited, but that's not supposed to happen :) I'll see if I can glean anything from the savegame, thanks for posting!
It looks like at one of the stations, a train didn't clear (by only a pixel or so!) tracks, so next train couldn't go in, but also if it was trying to manage itself and delete minus revenue trains (if it does that anyway), it also couldn't do that to get out of the problem as it blocked the depot. Maybe a slight change to signals around stations may resolve it?
2023-05-31 13_43_10-OpenTTD 13.1.png
2023-05-31 13_43_10-OpenTTD 13.1.png (47.49 KiB) Viewed 9481 times

Re: ChooChoo, a train network AI

Posted: 31 May 2023 13:14
by Michiel
Wow, nice catch! I've never seen a jam like this, but that's obviously something that needs fixing. I'll see what I can do.

Re: ChooChoo, a train network AI

Posted: 31 May 2023 15:14
by Michiel
Ah, the problem is that the signal building was indeed subtly wrong. It builds paths "in reverse", so the first signal block out of a station, which is actually built last, might not have the required minimum length, causing a possible jam. I have a fix in the works.

Re: ChooChoo, a train network AI

Posted: 31 May 2023 20:14
by Michiel
Redirect Left wrote: 31 May 2023 07:21 Hi there! Your AI struggled in tests for the AI list update for June. It created trains endlessly, until it jammed itself up. It now seems to be unable to correct the issue on this line by itself.

I've attached an image of the issue, and the savegame file.
Update released! It now builds all track from exit to entrance, so it can ensure proper sized signal blocks. That ought to fix the potential to deadlock the station exit. I also found out (after all these years!) that trains take up more tiles diagonally, so I've increased the distance between signals to ensure that a train will always fit in a block.

Re: ChooChoo, a train network AI

Posted: 16 Jun 2023 23:16
by BenArt86
Hi, this happened and I saw that it said to post the error here. I am a 100% newb to the forum and I 100% do not know how to play this game, I just love the game and have done for many many years, learning the actual rules never interested me as much as making a map and enjoying watching the cities grow (with cheats). So I apologise if this had been posted or it's a waste of time or an obvious problem. I simply just play the game to build cities and love to build roads and such and your AI is a perfect accompaniment to my map building enjoyment. I hope this helps and thank you for the AI. (See attached photo, If I managed to attach it correctly that is).

Re: ChooChoo, a train network AI

Posted: 20 Jun 2023 07:27
by arikover
BenArt86 wrote: 16 Jun 2023 23:16 Hi, this happened and I saw that it said to post the error here.
Hello BenArt86, and welcome to the forums.
As stated on the error message, you are missing a library that ChooChoo uses. It is the Pathfinder.Road version 3.

You can download it via the online content on the title screen:
Online_Content.png
Online_Content.png (354.29 KiB) Viewed 9304 times
Pathfinder.png
Pathfinder.png (1.11 MiB) Viewed 9304 times

Re: ChooChoo, a train network AI

Posted: 20 Jun 2023 18:14
by Michiel
Thanks for jumping in @arikover! Hopefully that helped BenArt86 out :)

Still, I think OpenTTD should have automatically installed the dependency along with the AI, so I will check if maybe I misconfigured something in the last updates.

Edit: yes, looked like that either got lost in an update, or maybe it was never there and my AI was just tagging along on the library downloaded by/for another AI. Should be fixed now!

Re: ChooChoo, a train network AI

Posted: 13 Feb 2024 11:43
by peter1138
This AI assumes that MAIL exists as a cargo, and will crash if it does not exist.

Re: ChooChoo, a train network AI

Posted: 23 Feb 2024 07:46
by Michiel
peter1138 wrote: 13 Feb 2024 11:43 This AI assumes that MAIL exists as a cargo, and will crash if it does not exist.
Thanks for the bug report! Fixed in the latest version :)

Re: ChooChoo, a train network AI

Posted: 23 Feb 2024 12:47
by Captain Rand
Hi Michiel,

I have a feature request/suggestion.
As programmed, ChooChoo has trains running on the right on double tracks. Would it be possible to add a parameter to have them running on the left? Is this possible?

I love ChooChoo, and always have multiple instances running in my games. I use Infrastructure sharing and your AI helps me build some awesome networks.

Many thanks,

Pete.

Re: ChooChoo, a train network AI

Posted: 23 Feb 2024 19:51
by Michiel
Thanks Pete! Apart from the occasional bug report I have really no way of knowing if people still use these AIs, so that's great to hear :D

As for your request... I'm Dutch, and we drive on the right side, so everything else is the wrong side ;-)
Theoretically the code should be able to support swapping sides fairly easily, but that could lead to some interesting bugs... I'll think about it :)

Re: ChooChoo, a train network AI

Posted: 25 Feb 2024 19:01
by Captain Rand
I'm English. We drive on the left, which is right. You're driving on the right, which is wrong...... :D
*Cough* .... Moving on....

What I'm suggesting is a parameter setting for when the AI first starts. Building it's tracks either left or right driving from when it first spawns. this shouldn't be swappable after the AI starts.
Hope this makes sense, I feel I'm not explaining it very well.

Pete.

Re: ChooChoo, a train network AI

Posted: 01 Mar 2024 18:09
by Michiel
:lol:

> Hope this makes sense, I feel I'm not explaining it very well.

No worries, perfectly clear :)

For Choo Choo, the choice for driving on the left or right would be locked in per network, so you could even change the setting during a game, and then future networks would take that into account.

Re: ChooChoo, a train network AI

Posted: 01 Mar 2024 19:06
by Captain Rand
Michiel wrote: 01 Mar 2024 18:09 For Choo Choo, the choice for driving on the left or right would be locked in per network,
Yes, this is exactly what I mean.

Pete.

Re: ChooChoo, a train network AI

Posted: 04 Mar 2024 20:47
by Michiel
By popular request (hi Pete!) ChooChoo now also supports left hand traffic on double tracks!

The default setting is now to use the same drive side as road traffic (as set in game options) but you can also force it to left or right hand traffic. If you change the setting during a game, it'll take effect when ChooChoo starts a new rail network.
left-hand.png
left-hand.png (441.48 KiB) Viewed 5211 times
traffic-side-settings.png
traffic-side-settings.png (8.33 KiB) Viewed 5211 times