ChooChoo, a train network AI
Moderator: OpenTTD Developers
Re: ChooChoo, a train network AI
the index 'find' does not exist
- Attachments
-
- Unnamed, 1955-07-31.png (43.45 KiB) Viewed 10042 times
-
- R25-G21 - ChooChoo vs PathZilla - 7,463 days.sav
- (3.43 MiB) Downloaded 401 times
Formerly known as Samu
- Redirect Left
- Tycoon
- Posts: 7337
- Joined: 22 Jan 2005 19:31
- Location: Wakefield, West Yorkshire
Re: ChooChoo, a train network AI
I've also had this just now with find error, on a map with lots of AIs and me spectating them.
Unfortunately the author has gone AFK for over 2 years at this point, so we might be on our own. Unless someone heree knows how to fix it, i've tried numerous times but i can't get the AI programming language down, it's very confusing and non-sensical to me, otherwise i'd have a good go at fixing numerous issues with lots of old AIs.
Unfortunately the author has gone AFK for over 2 years at this point, so we might be on our own. Unless someone heree knows how to fix it, i've tried numerous times but i can't get the AI programming language down, it's very confusing and non-sensical to me, otherwise i'd have a good go at fixing numerous issues with lots of old AIs.
Re: ChooChoo, a train network AI
I was trying out some AIs, including ChooChoo and noticed it wasn't working. I fixed two breaking bugs:
- Updated road pathfinding library version from 3 to 4
- Checked that a returned vehicle name is not null before doing name.find("X")
- Attachments
-
- choochoo-412-findbug-libupgrade.patch
- (867 Bytes) Downloaded 435 times
-
- ChooChoo412-a.tar
- (180 KiB) Downloaded 407 times
- Donald Duck
- Engineer
- Posts: 18
- Joined: 24 Apr 2020 07:05
Re: ChooChoo, a train network AI
I tried using this AI and got some errors:
Re: ChooChoo, a train network AI
That is not an error from AI, but your installation. Use the update function from ingame or install manually Pathfinder library version 3
Re: ChooChoo, a train network AI
Hello! Not dead, just busy elsewhere. Looks like it doesn't download that library automatically (anymore). I'll see if I can package a copy with my AI, so it just works out of the box.
Re: ChooChoo, a train network AI
It's working again! You may have to update or reload the AI from the "check online content" screen.
Re: ChooChoo, a train network AI
Hello,
Now I completely understand what it says there, that it's not an actual error, but to be safe and sound, is it not? Should I reload the AI or leave it at that?
Here's the screenshot from today:
Now I completely understand what it says there, that it's not an actual error, but to be safe and sound, is it not? Should I reload the AI or leave it at that?
Here's the screenshot from today:
Re: ChooChoo, a train network AI
No, that's a real error. The "the following red text is not an actual error" message is out of date; older versions of the game would print (in red text) all errors, even ones handled by the program. That appears not to be the case anymore. However, the red text you see now *is* a real error and you'll have to reload the AI.
I'm not sure what happened though - did you rename some of the AI's vehicles? It stores information in the name, so that'll confuse it.
Or maybe it tried to delete the same vehicle twice - once on its yearly "cleanup" loop, and once more because it received a "vehicle unprofitable" event. The second can then fail because the vehicle is already gone. That looks like it's very unlikely to happen, but possible :-/
I'm not sure what happened though - did you rename some of the AI's vehicles? It stores information in the name, so that'll confuse it.
Or maybe it tried to delete the same vehicle twice - once on its yearly "cleanup" loop, and once more because it received a "vehicle unprofitable" event. The second can then fail because the vehicle is already gone. That looks like it's very unlikely to happen, but possible :-/
Re: ChooChoo, a train network AI
choo choo always crashing with the index find does not exist error
what I think it happened: A vehicle was unprofitable event happened. Before choochoo got to it, the vehicle crashes and poofed
when it tried to handle the event, it got the vehicle id of it, but the vehicle is no longer valid
tried to get the name of the vehicle, but since it wasn't a valid vehicle it returned null
name.find("X") crashes the script, because can't use find on null
what I think it happened: A vehicle was unprofitable event happened. Before choochoo got to it, the vehicle crashes and poofed
when it tried to handle the event, it got the vehicle id of it, but the vehicle is no longer valid
tried to get the name of the vehicle, but since it wasn't a valid vehicle it returned null
name.find("X") crashes the script, because can't use find on null
- Attachments
-
- screenshot#6.png
- (259.98 KiB) Not downloaded yet
Formerly known as Samu
- Redirect Left
- Tycoon
- Posts: 7337
- Joined: 22 Jan 2005 19:31
- Location: Wakefield, West Yorkshire
Re: ChooChoo, a train network AI
During my mass AI testing for this thread, I have also run into this, and it was during the process of it wiping non-profitable vehicles, so i think you're right.xarick wrote: ↑03 Jun 2022 11:15 choo choo always crashing with the index find does not exist error
what I think it happened: A vehicle was unprofitable event happened. Before choochoo got to it, the vehicle crashes and poofed
when it tried to handle the event, it got the vehicle id of it, but the vehicle is no longer valid
tried to get the name of the vehicle, but since it wasn't a valid vehicle it returned null
name.find("X") crashes the script, because can't use find on null
It listed all the vehicles it was wiping, and then it came across one that isn't defined (I presume this is what would return null) and it crashed.
Sadly the author hasn't been about since mid 2022, so it might be bad news for any official fix.
It's a really nice AI though, so it'd be nice to try fixing it outside of that if they're unavailable.
- Attachments
-
- 2023-03-15 19_17_43-OpenTTD 13.0.png (12.41 KiB) Viewed 9321 times
Re: ChooChoo, a train network AI
Turns out, flattery will get you everywhere :-psome of the AI I've tested are genuinely really good at what they do, even if they are a bit flawed (looking at you ChooChoo, with your magnificent networks)
I've just uploaded version 413 that fixes the bug, and adds an option (which is on by default) to not crash on unexpected errors, but just keep going. It's still possible a bug will leave the AI dead in the water, but it might also be that the error is survivable and the AI can at least keep playing.
Unfortunately, I was unable to find a way to print a stack trace without letting the error "escape" and kill the AI, so if you want to report a bug in the future, please turn off this option and send me a screenshot with a stack trace in it:
- Redirect Left
- Tycoon
- Posts: 7337
- Joined: 22 Jan 2005 19:31
- Location: Wakefield, West Yorkshire
Re: ChooChoo, a train network AI
Haha, I'm glad to hear it in this case, it's one of the best AI I've come across in terms of networking things together reliably.
It's really great to see you return to try patching it up, and I hope you're able to continue doing so, as it was the one i was contemplating the most on forking and patching up myself, saves me a job!
For the record, the example in the document for its weird track building which i cannot find any logic behind was this. Some of them are the exact shape of an industry, so i presume at one point an industry was in the way, and built around, but never corrected after the industry went under, but this one? I ain't too sure about.
Re: ChooChoo, a train network AI
You're welcome!
I think I can explain that. The logic is that it never was "connecting Wunnbury and Sonbourne". Instead, it started from the junction (the bit in the top left, with the waypoint) and then started extending it. It managed to connect the SW exit to Wunnbury and the NE exit to Sonbourne, and then didn't find valid/reachable towns for the NW and SE exits, so those got deconstructed and you end up with this weird looking loop.
I do find it surprising that it considered Sonbourne for the NE exit, since it's actually to the south of that exit, but I don't remember how the selection exactly works.
It never does any "corrections" to track after its built, by the way. That would be an awesome feature to add, to remove unused track and try to optimize tracks that are still used. But I never got around to implementing that.
I think I can explain that. The logic is that it never was "connecting Wunnbury and Sonbourne". Instead, it started from the junction (the bit in the top left, with the waypoint) and then started extending it. It managed to connect the SW exit to Wunnbury and the NE exit to Sonbourne, and then didn't find valid/reachable towns for the NW and SE exits, so those got deconstructed and you end up with this weird looking loop.
I do find it surprising that it considered Sonbourne for the NE exit, since it's actually to the south of that exit, but I don't remember how the selection exactly works.
It never does any "corrections" to track after its built, by the way. That would be an awesome feature to add, to remove unused track and try to optimize tracks that are still used. But I never got around to implementing that.
Re: ChooChoo, a train network AI
Hey Michiel, do you have a repository of your AI on Github. I have made a few changes to the code, which improve the flow of train traffic on junctions, and also the way buses load and transfer passengers. Not sure if you're interested.
Btw, as I was speaking, here's a savegame of a massive train jam.
Btw, as I was speaking, here's a savegame of a massive train jam.
- Attachments
-
- autosave1.sav
- (14.88 MiB) Downloaded 204 times
-
- Unnamed, 1941-09-12.png
- (382.43 KiB) Not downloaded yet
Formerly known as Samu
Re: ChooChoo, a train network AI
Congratulations on 5000 trains!
- Attachments
-
- Unnamed, 1970-12-26.sav
- (16.31 MiB) Downloaded 226 times
-
- Choo Choo 5000 trains!.png (101.14 KiB) Viewed 9183 times
Formerly known as Samu
- Redirect Left
- Tycoon
- Posts: 7337
- Joined: 22 Jan 2005 19:31
- Location: Wakefield, West Yorkshire
Re: ChooChoo, a train network AI
haha, nice. I have to limit AI to 2500 trains, 1000 RVs, 250 aircraft & 250 ships for my mass AI testing, else it runs to a crawl, even on an i9-12900
Re: ChooChoo, a train network AI
Not yet, it's currently in a private Subversion repo, but I was already thinking of moving it to GitHub, so... soon? I can't promise I'll accept pull requests, but I'll definitely look at them!
Wow I'll take a look at that save later!
Re: ChooChoo, a train network AI
Just sent a Draft Pull Request. Some changes you might disagree with and that's fine.
From my testings it becomes a bit more competitive early on, but at some cost of jams in the long run, which I tried to address by sending trains to always visit depots. Might require more intervention in the way trains are duplicated, or the spacing between signals to allow a more compact number of trains, another idea I had was to come up with a way to never have trains blocking a junction while waiting for a free path, but I didn't manage to do it properly and gave up.
From my testings it becomes a bit more competitive early on, but at some cost of jams in the long run, which I tried to address by sending trains to always visit depots. Might require more intervention in the way trains are duplicated, or the spacing between signals to allow a more compact number of trains, another idea I had was to come up with a way to never have trains blocking a junction while waiting for a free path, but I didn't manage to do it properly and gave up.
Formerly known as Samu
Who is online
Users browsing this forum: No registered users and 1 guest