[kovarex] [0.16] Train pathfinding with many same named stations

Bugs that are actually features.
Post Reply
Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

[kovarex] [0.16] Train pathfinding with many same named stations

Post by Cleany »

So my factory uses the same name for all ore stations. Every iron ore station is called A: IRON etc.

Before my iron ore trains would all be routed to A: IRON of which there are many. The trains would all find empty stations, ignoring the ones that were occupied.

This no longer seems to be happening. Now trains are all waiting at 2 stops, completely ignoring the others.

I didn't see any relevant change regarding this in the log. Perhaps I missed it. If this is a bug could someone please confirm as I don't know what to do with my stations. Going back to having a train for each ore station would be unpleasant!

cbhj1
Fast Inserter
Fast Inserter
Posts: 166
Joined: Tue Apr 25, 2017 2:53 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by cbhj1 »

I suspect it is related to the fix here viewtopic.php?t=54042#p321153 the occupied stations are no longer giving a 4B+ pathing penalty

Koub
Global Moderator
Global Moderator
Posts: 7203
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Koub »

There have been a few bugfixes on the train pathing through station subject, and maybe what you experience is a consequence of them :
16.0 : Fixed that train arriving to station could give astronomically big penalty causing trains to go through weird places. (54042)
16.3 : Train stop penalty is applied when exiting the block with it instead of entering which should prevent searching for long paths just before destination train stop.
Do these explain what you consider a strange behaviour ?
Koub - Please consider English is not my native language.

goldomusclor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 25, 2017 2:42 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by goldomusclor »

I believe I have the same issue and I don't think it is explained by those bug fixes, and i've tested i can reproduce the problem on both 0.16.2 and 0.16.7

What is happening for me:
I have several green circuit outpost, each with:
. waiting area
. iron unloading station
. copper unloading station
. green circuit loading station
. track from waiting area to main tracks (so that the trains can leave from the waiting area and go to another station).

all the copper (resp iron) station are named the same.

from this initial situation:
copper train 1 waiting in outpost A
copper train 2 unloading in outpost A
copper train 3 unloading in outpost B (same station name as outpost A)

now if copper train 3 leaves outpost B:

in 0.15.X:
copper train 1 would leave outpost A and go to B:

copper train 1 unloading in outpost B
copper train 2 unloading in outpost A
copper train 3 at mine

in 0.16.X:
copper train 1 stays at outpost A, and after loading at mine copper train 3 goes to outpost A !

copper train 1 waiting in outpost A
copper train 2 unloading in outpost A
copper train 3 waiting in outpost A
copper station is empty at outpost B !

attached is the screenshot of one such outpost (the stations "green circuit copper" and "green circuit iron" are replicated 3 or 4 times on the map):
outpost
outpost
greencircuitoutpost.PNG (349.22 KiB) Viewed 4930 times
stations
stations
copper train stations.PNG (3.84 MiB) Viewed 4930 times
and after a few minutes on 0.16.7:
stuck !
stuck !
stuck.PNG (2.45 MiB) Viewed 4930 times
here is a save : https://drive.google.com/file/d/1a4n00Q ... sp=sharing
if you load and wait 5min:
. on 0.15.X, all trains are running smoothly and dispatched the different stations
. on 0.16.X, all trains will end up waiting in the same outpost (as per the attachment above)

btw, the base has moved from 30/35fps to 60fps on my computer by moving to 0.16.X, that's quite an impressive feat !

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

Koub wrote:There have been a few bugfixes on the train pathing through station subject, and maybe what you experience is a consequence of them :
16.0 : Fixed that train arriving to station could give astronomically big penalty causing trains to go through weird places. (54042)
16.3 : Train stop penalty is applied when exiting the block with it instead of entering which should prevent searching for long paths just before destination train stop.
Do these explain what you consider a strange behaviour ?
No I honestly don't think so.

Simply put, I have many (5-10) stations with exactly the same name, and many (20-30) trains assigned to those stations. (Though in the dialogue they are all assigned to one station as they all have the same name).

Before the update, the trains would visit any station that was unoccupied. Now all of the trains are waiting around 2 stations, as if the other stations do not exist.

p.s. as the above chap said, the optimisations are amazing, I've gone from 40 - 60UPS.

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Zavian »

The reason these types of setups worked in 0.15 is probably because of
16.0 : Fixed that train arriving to station could give astronomically big penalty causing trains to go through weird places. (54042)
As I under things, the train station penalty was only intended to be something like 2000. So if 2 stations with the same name were relatively close (less than 2000 tiles difference in the path length when a train calculates it's path), then trains would prefer the empty station. If the distance in path lengths was more than 2000 tiles, then they would prefer the closer station. viewtopic.php?t=54042 meant that instead of applying 2000 penalty, the trains were applying over 4 billion penalty for an train in a station.

In other words the behaviour you were using was the unintended result of a bug that is now fixed. Atm the easiest way to force trains to repath is probably to disable the station, if there is a trian already unloading, and another train queued to unload. Another way is to not name the stations the same and have dedicated trains going to each station.

Koub
Global Moderator
Global Moderator
Posts: 7203
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Koub »

Zavian wrote:In other words the behaviour you were using was the unintended result of a bug that is now fixed.
That's a way better formulation of what I wanted to express in my post :) I'm jealous now :P
Koub - Please consider English is not my native language.

goldomusclor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 25, 2017 2:42 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by goldomusclor »

I'm fine either way, but isn't unintended result just another word for bug :) ?

I always found the 0.15 behaviour too good to be true, but without it, it does complexify a lot my current base.

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

Zavian wrote:In other words the behaviour you were using was the unintended result of a bug that is now fixed. Atm the easiest way to force trains to repath is probably to disable the station, if there is a trian already unloading, and another train queued to unload. Another way is to not name the stations the same and have dedicated trains going to each station.
It's quite simple. Is it the intention of the devs to make it so that trains will use multiple stations of the same name.

For most of it's life my factory ran with trains with stations with different names - IRON 1, or IRON NE etc. I only decided to use the same name thing because I thought it was a feature as I had read about it a couple of times.

So that is the question. I don't see why identical station names are allowed multiple trains aren't supposed to be able to route to them properly. Otherwise identical station names should not be permitted!

The devs know if it is a bug or not.

Koub
Global Moderator
Global Moderator
Posts: 7203
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Koub »

I think the feature is meant to allow people to stack stations "on top of each other", like for example 5 "Iron for Circuits" stations in parallel in your green curcuits factory. That way, a free one will be chosen when a train with iron arrives. However, it's not intended to be used in a way that you, for example, name all your iron outposts "Iron outpost", and your train pathes to whatever outpost is free.

That's my understanding of the feature.
Koub - Please consider English is not my native language.

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

Koub wrote:I think the feature is meant to allow people to stack stations "on top of each other", like for example 5 "Iron for Circuits" stations in parallel in your green curcuits factory. That way, a free one will be chosen when a train with iron arrives. However, it's not intended to be used in a way that you, for example, name all your iron outposts "Iron outpost", and your train pathes to whatever outpost is free.

That's my understanding of the feature.
That sums it up yeah. I did have all of my home ore stations named the same, and then later I used it for the outposts.

I worked really well! :-D

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

Thinking about it, whether or not it is technically a bug, is it preferable to have about 12 trains waiting for one station, and about 6 at another, when there are around 5 other stations with exactly the same name not too far away?

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

OK I just checked. I have 18 trains waiting for one station ": COAL", around 1500 tiles away (by track, not as the crow flies) is another station ": COAL", no trains have attempted to reach it.

goldomusclor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 25, 2017 2:42 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by goldomusclor »

I haven't been able to reproduce the issue when creating a test map with creative mod (even though the train network is longer than in my base), the trains go to all stations.
I've also tried playing around with the value train_stop_penalty (from viewtopic.php?t=54042#p321153) to both 10 and 20000000 but this didn't change anything. (I modified the lua file manually).

Koub
Global Moderator
Global Moderator
Posts: 7203
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Koub »

Can you add your savefile ? maybe one of our train gurus or a dev will be able to tell what's wrong (either in our comprehension, or in the game :)).

[Edit] D'oh call me stupid :oops:
Koub - Please consider English is not my native language.

goldomusclor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 25, 2017 2:42 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by goldomusclor »

it is in my first post (below the screenshots) :)

goldomusclor
Burner Inserter
Burner Inserter
Posts: 5
Joined: Mon Dec 25, 2017 2:42 pm
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by goldomusclor »

hum, in my base, the trains are with basic cargo full/cargo empty conditions and i've not been able to isolate a case to reproduce the same.
However if I change the conditions to "wait until", then I can get the trains to misbehave.

map originally done with creative mods, but disabled when saving.
The difference between the two maps are just the condition on the station named out

Just switch on the power to start the trains (above the player when loading)

Expected behavior : trains go to all 8 stations named out

wait condition: https://drive.google.com/file/d/1ZILtgh ... HkDr5PNyz0
=> trains only go to the first 4 stations

empty condition: https://drive.google.com/open?id=15jAjH ... KUrJjW4rEa
=> trains go to the 8 stations

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

Re: 0.16 Train pathfinding with many same named stations

Post by kovarex »

goldomusclor wrote:hum, in my base, the trains are with basic cargo full/cargo empty conditions and i've not been able to isolate a case to reproduce the same.
However if I change the conditions to "wait until", then I can get the trains to misbehave.

map originally done with creative mods, but disabled when saving.
The difference between the two maps are just the condition on the station named out

Just switch on the power to start the trains (above the player when loading)

Expected behavior : trains go to all 8 stations named out

wait condition: https://drive.google.com/file/d/1ZILtgh ... HkDr5PNyz0
=> trains only go to the first 4 stations

empty condition: https://drive.google.com/open?id=15jAjH ... KUrJjW4rEa
=> trains go to the 8 stations
The saves are from 0.15, and the second case, where train went to all the stations was caused by the bug of huge penalty fixed in 0.16.
Now they always go only to the first 4 stations, which probably isn't what you wanted but it is consistent.

The general purpose of having station named the same was to allow multi-platform stations, not to select train the unoccupied station of that kind in the whole map, the only reason it worked was the bug with the huge latency.

But I saw a save where people made it work through circuit network, they activated stations only when there was some cargo to take, or when the output was empty enough when it was input station.

If we wanted system of "same station name used across the map" work nicely even without circuit network, we might try to make a solution for that, but it would be a feature, not a bug fix.

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: 0.16 Train pathfinding with many same named stations

Post by Cleany »

kovarex wrote:The general purpose of having station named the same was to allow multi-platform stations, not to select train the unoccupied station of that kind in the whole map, the only reason it worked was the bug with the huge latency.

But I saw a save where people made it work through circuit network, they activated stations only when there was some cargo to take, or when the output was empty enough when it was input station.

If we wanted system of "same station name used across the map" work nicely even without circuit network, we might try to make a solution for that, but it would be a feature, not a bug fix.
Thanks for clearing that up. I was waiting to know what the actual intention was. Now that I know, I can go and play with signals and circuits :-)

Cleany
Long Handed Inserter
Long Handed Inserter
Posts: 72
Joined: Sat Aug 13, 2016 10:41 am
Contact:

Re: [kovarex] [0.16] Train pathfinding with many same named stations

Post by Cleany »

Ok I solved the problem of not being able to give all of your mining stations the same name by turning off the stations when they run out of ore. The trains reroute when the stations turn off, but they would not reroute when it was occupied.

Post Reply

Return to “Not a bug”