[0.14.x] [Hanziq] train plans a self-intersecting route

This subforum contains all the issues which we already resolved.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

[0.14.x] [Hanziq] train plans a self-intersecting route

Post by db48x »

This is going to be a fairly rare problem, but I hope you fix it regardless.

I was playing a multiplayer game the other night, riding a train out to the hinterlands to bring in some more ore. The game had several mods, including the FARL, but as mods cannot to my knowledge modify the train behavior, I don't think they are the cause. As I was riding the train, I adjusted the train's schedule. I don't recall the precise adjustments I made, but I believe I rearranged the stops by removing one and adding it in a different position. It seems that I happened to do this exactly while I was in the loop you see here. The train apparently decided to turn around and head east, then as I completed my adjustment it decided to head west afterall. The result is the stuck trains you see here.

Of course this is exacerbated by having such tight loops in the tracks, but I didn't design the track network. In any case, the train should have planned a longer route that didn't self-intersect; there are plenty of other loops about the place where it could have successfully turned around.
Attachments
screenshot showing the self-intersecting route
screenshot showing the self-intersecting route
factorio train routed in a loop.png (3.53 MiB) Viewed 6695 times
User avatar
HanziQ
Former Staff
Former Staff
Posts: 630
Joined: Fri Mar 27, 2015 7:07 am
Contact:

Re: train plans a self-intersecting route

Post by HanziQ »

There is a bug, that the train cannot reserve a block in which it is located, that should be fixed for 0.13. This will of course mean, that if the train is too long, it will hit itself, which we do not consider a bug. I'm not sure if I can get rid of the self-intersecting paths in the pathfinder.
User avatar
db48x
Fast Inserter
Fast Inserter
Posts: 106
Joined: Wed Mar 13, 2013 12:15 pm
Contact:

Re: train plans a self-intersecting route

Post by db48x »

Hmm. You know the lengths of the blocks and the length of the train. If a block in the route is reserved twice, or is the block the train is currently in, then add up the lengths of the blocks between these two endpoints and compare it to the length of the train?

On the other hand, I just thought of a track design that would cause a false-positive: the block it enters twice might have two parallel tracks and the train would not actually self-intersect. Difficult indeed.

Perhaps your idea of having the train proceed but potentially crash into itself is a good one.
jonatkins
Fast Inserter
Fast Inserter
Posts: 155
Joined: Wed Sep 30, 2015 7:29 pm
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by jonatkins »

I've had this twice in the current 0.15 experimental releases, and these were naturally occurring due to the periodic train reroute calculations - no manual timetable editing.

One possible (but hacky) workaround I can suggest - if a train is stopped at a chain signal AND the blocking train is itself,
then treat the chain signal as a regular signal temporarally.

This way, if the train is short enough to fit on the loop it should get unstuck. If it's long, it'll still get stuck, but it'll solve a lot of cases.

It doesn't even need to be immediate - start a timer when stopped at a chain signal, and if it fires before the train moves, perform this extra check.

Do you think this might help?
ARC190
Inserter
Inserter
Posts: 27
Joined: Sat May 23, 2015 9:03 am
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by ARC190 »

https://www.dropbox.com/s/qh209mge6sa8q ... 7.png?dl=0
this seems like a really bad pathfinding bug. instead of doing a simple 90° turn, the train wants to go around the whole roundabout before going in the right direction.
Last edited by ARC190 on Sat Jun 03, 2017 7:17 pm, edited 1 time in total.
Loewchen
Global Moderator
Global Moderator
Posts: 9279
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by Loewchen »

ARC190 wrote:Image
this seems like a really bad pathfinding bug. instead of doing a simple 90° turn, the train wants to go around the whole roundabout before going in the right direction.
You will need to post a public link of your image instead of your private URL if you want us to be able to see it.
BlackMoon
Inserter
Inserter
Posts: 42
Joined: Wed Aug 06, 2014 7:15 am
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by BlackMoon »

Still not fixed as of 15.20. Can happen in vanilla game.

Issue is the train decides to change its path after it enters the roundabout, so it picks the exit it already passed.
Bug is: Train can change paths in middle of chain signal block... And furthermore when it does, it picks paths it can't reserve.

See: viewtopic.php?f=41&t=26409
And viewtopic.php?f=41&t=19619
yura881
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Feb 11, 2016 3:10 pm
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by yura881 »

When you fix this?
Attachments
20171002225557_1.jpg
20171002225557_1.jpg (906.9 KiB) Viewed 5430 times
Zavian
Smart Inserter
Smart Inserter
Posts: 1649
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by Zavian »

Yura881 : this bug is about trains choosing a self-intersecting path instead of a shorter non-intersecting path. (And we think that they are choosing to repath inside an intersection). In your case you can probably greatly reduce the likelihood of your train having issues by adding a left turn at the northern entrance to the roundabout, and giving the train a shorter non-intersecting path.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5286
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.14.x] [Hanziq] train plans a self-intersecting route

Post by Klonan »

This was likely fixed
Post Reply

Return to “Resolved Problems and Bugs”