[0.8.8] train passing by occupied station

This subforum contains all the issues which we already resolved.
Post Reply
jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

[0.8.8] train passing by occupied station

Post by jeroon »

Not sure if it's a bug , or a feature..

I've got quite a few trains running, and i noticed trains in places i didn't expect them. Two trains ride between a loading station and a unloading station. Screenshot is the 'loading' station, and when the station is occupied, the second train (that has this station as destination) passes it, does a loop a bit further down the line, comes back, checks if the station is free, and if it's still (/again) occupied, drives past in the other direction, does a loop there, and comes back again. Black arrow is where i want it to go (where is should go), white arrow is where it's going. I tried to recreate it in a smaller setting, but then the train just stopped at the last signal and waited for the station to become free.

Image

Game save: https://www.dropbox.com/s/ixmvvpnv3hniy ... tation.rar (Limit to attach files is 3 MB, this one is 6 MB rarred ;) )

slpwnd
Factorio Staff
Factorio Staff
Posts: 1835
Joined: Sun Feb 03, 2013 2:51 pm
Contact:

Re: [0.8.8] train passing by occupied station

Post by slpwnd »

Sorry for the long time waiting. We are now processing the bugfixes from the backlog. Could you please post the save again (the link has expired)?

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.8.8] train passing by occupied station

Post by ssilk »

I know what he meant, cause I found that too. You can look into the latest saves for the "80"-world from me:
https://drive.google.com/folderview?id= ... sp=sharing
In the center at the Moondrixx-station you can see sometimes the situation, that the rail to the south is blocked. In that case the train, starting from Moondrix station, will make the turn to the west (refinery-part) and then going down instead of going the way directly to the south.
Which doesn't make sense. It would be much more efficient just to wait.

The pathfinder seems to make no difference in much longer paths, which are valid, but don't make sense, because it takes a much, much longer way around.

This happens only, if the direct path is blocked (train/signal, like in the pic above). Then the pathfinder searches for such alternatives.

I think there are many possibillities to fix this, but maybe it should just compare all possible tracks and if an alternate route is much longer than the shortest (but blocked) track, then it should wait.

Code: Select all

pseudocode:

weightedShortTrack = lengthOfShortTrack
weightedLongTrack = lengthOfLongTrack / 2
difference = weigthedLongTrack - weightedShortTrack


if difference > 5 then
   itIsBetterToWait()
else
   itIsBetterToRunAround()


Example: lengthOfShortTrack = 10; lengthOfLongTrack = 20;

=> weightedShortTrack = 10, weightedLongTrack = 10,
=> difference is 0.

=> So the if goes to false, which means it may run around.
=> If the lengthOfShortTrack 4, then the difference to the long gets to big and it will wait.
of course the computation needs more intelligent tuning. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by jeroon »

Bah, I just deleted all those old factorio saves from dropbox last week :/ I've tried to make a small test scenario, but couldn't reproduce the behavior. I've also played with ssilks save for a bit, but didn't see anything weird happen.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: [0.8.8] train passing by occupied station

Post by ssilk »

Nobody believes me. :cry:

Well, this save will show what I mean:

https://drive.google.com/file/d/0BxC7zF ... sp=sharing

1. After some seconds a short oil-train comes in from east and drives to the west to Cyborg train-stop.
2. Some seconds later the previous train from Cyborg train-stop, which had finished unloading, comes from west and drives down.
3. Now the big support train comes from east and stops at Moondrix train-stop.
4. Now wait about 10 seconds.
5. The train from #2, which unloaded at Cyborg train-stop comes from west and reserves the signal path (yellow); he follows train from #1.
6. In the same moment the train at Moondrix train-stop restarts and instead of going to the south, he goes to the west, following #2 the long loop...

This doesn't happen, if the signals haven't been reserved...
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

jeroon
Filter Inserter
Filter Inserter
Posts: 351
Joined: Sun Jan 26, 2014 10:18 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by jeroon »

I got one now that's a little bit easier to see ;)

Save:

Train with 2 wagons enters the screen from the right, and wants to go to "Train Stop Coal Load", on the left hand side of the screen. To get there it has to pass "Train Stop fanyu" (copper), but the train there is blocking that way.

The coal train now passes the exit to the station all together, makes a loop somewhere, goes back to the unloading station (Train Stop Coal Unload), loops again, and comes back to try again, passing again if the line is still/again occupied.

The good part of this behavior: the main line isn't blocked, so the line won't clog up.
The bad part: there is no other route to the Coal station, so it might as well wait.

Not sure if it's a bug :)

PS: I've put the train on the copper station on manual stop, to test, but i saw it happen in automatic mode as well.

PS2: there are 2 copper trains for the Fanyu station. If the station is blocked, the second train does not loop, but wait in line. I've seen some train behavior where the train only checks for the first signal after the current one to make a decision, so the copper train sees it's path blocked after that second signal, while the copper train sees it's station and waits. Just to complicate things a little ;)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by kovarex »

Quite late, but anyway ... fixed for 0.11.11

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by sillyfly »

Slowly but surely you are fixing all the bugs.
But may we have some more technical details as to how this is solved? Namely - what is the current (starting from 0.11.11) pathfinding algorithm?
Thanks!

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by kovarex »

sillyfly wrote:Slowly but surely you are fixing all the bugs.
But may we have some more technical details as to how this is solved? Namely - what is the current (starting from 0.11.11) pathfinding algorithm?
Thanks!
Until now, it was hardcoded, that path that is the next block (or the next after that) just in front of the train got always lower priority than anything else when the part was occupied.

Currently occupied blocks just get penalty of distance (100 + length of block) / (1 + block distance from start).
So for one block of length 20 that is just in front of the train, the block gets penalty (120 + 2)/2 -> 61 tiles.

Choumiko
Smart Inserter
Smart Inserter
Posts: 1352
Joined: Fri Mar 21, 2014 10:51 pm
Contact:

Re: [0.8.8] train passing by occupied station

Post by Choumiko »

kovarex wrote:Currently occupied blocks just get penalty of distance (100 + length of block) / (1 + block distance from start).
So for one block of length 20 that is just in front of the train, the block gets penalty (120 + 2)/2 -> 61 tiles.
Meaning the train will only go the alternative route if it's length is <= 61 tiles, else he will wait at the occupied block? (shouldn't it be (120 + 20)/2 -> 70 in your example?) ;)

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.8.8] train passing by occupied station

Post by kovarex »

Choumiko wrote:
kovarex wrote:Currently occupied blocks just get penalty of distance (100 + length of block) / (1 + block distance from start).
So for one block of length 20 that is just in front of the train, the block gets penalty (120 + 2)/2 -> 61 tiles.
Meaning the train will only go the alternative route if it's length is <= 61 tiles, else he will wait at the occupied block? (shouldn't it be (120 + 20)/2 -> 70 in your example?) ;)
Yes 70 .., the exact numbers might change, but this should be much better than what we have now.

Post Reply

Return to “Resolved Problems and Bugs”