Request: Max number of trains for stations

Post all other topics which do not belong to any other category.
dyce
Burner Inserter
Burner Inserter
Posts: 16
Joined: Mon Jul 08, 2019 9:13 am
Contact:

Re: Request: Max number of trains for stations

Post by dyce »

Have you made any progress on this?

tamanous
Fast Inserter
Fast Inserter
Posts: 138
Joined: Wed Aug 10, 2016 8:35 am
Contact:

Re: Request: Max number of trains for stations

Post by tamanous »

There have been at least two threat in the ideas and suggestions subforum.
There are mods that offer help.

My current vanilla workaround: wire the rail signal at the entrance of each waiting bay lane to the train station and set the station to activate when red = [lanes -1].

Eketek
Long Handed Inserter
Long Handed Inserter
Posts: 60
Joined: Mon Oct 19, 2015 9:04 pm
Contact:

Re: Request: Max number of trains for stations

Post by Eketek »

It seems to me that the train-with-no-destination problem can be resolved by allowing trains to go to a depot when there are no valid/reachable stops on its schedule.

Or even better: Conditional train stops, with 'next mandatory stop is disabled/unavailable' as one of the conditions which would cause a train to take an optional stop.

(Both of these solutions would probably require the train pathfinder the train scheduler to interact a bit - unless a re-positioned train with a reserved slot getting blocked by another train on the same route which is waiting for a slot is considered a fun problem to have)

mmmPI
Smart Inserter
Smart Inserter
Posts: 3577
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Request: Max number of trains for stations

Post by mmmPI »

I have looked through 100 pages of the mod portal yesterday, was looking for something else but found those instead, i think they deserve mentionning in this thread.

i haven't tested them quite yet but the descriptions sounds interestingly close to what this thread is about.


https://mods.factorio.com/mod/Concurren ... estriction
Restrict amount of trains trying to reach station simultaneously by circuit network.
( literaly the topic)

https://mods.factorio.com/mod/TrainSkipFulfilledStation
Changes trains behavior so they will skip a station if the "wait until" condition is already met
( may help )

https://mods.factorio.com/mod/SmartTrains
Seems like a more complex overhaul of the train system similar to what LTN or TSM would do, i just didn't know this one, in the description it is mentionned quite often "train lanes", and your ability to assign trains to them. Sounds like it could correspond.

P.E.T.A.R.
Burner Inserter
Burner Inserter
Posts: 10
Joined: Fri Jul 26, 2019 11:49 am
Contact:

Re: Request: Max number of trains for stations

Post by P.E.T.A.R. »

Just here to show support for stopping the thundering herd in vanilla.

michaeln
Burner Inserter
Burner Inserter
Posts: 5
Joined: Fri Apr 10, 2020 1:07 am
Contact:

Re: Request: Max number of trains for stations

Post by michaeln »

P.E.T.A.R. wrote:
Thu May 28, 2020 10:08 am
Just here to show support for stopping the thundering herd in vanilla.
Likewise!

FrodoOf9Fingers
Fast Inserter
Fast Inserter
Posts: 109
Joined: Sat Apr 29, 2017 11:13 pm
Contact:

Re: Request: Max number of trains for stations

Post by FrodoOf9Fingers »

Would also like max trains on a station.

ruspartisan
Burner Inserter
Burner Inserter
Posts: 15
Joined: Mon Jul 15, 2019 7:53 pm
Contact:

Re: Request: Max number of trains for stations

Post by ruspartisan »

Also waiting for feature like this.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2888
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Request: Max number of trains for stations

Post by boskid »

Maybe some day

Molay
Fast Inserter
Fast Inserter
Posts: 202
Joined: Thu May 01, 2014 8:01 am
Contact:

Re: Request: Max number of trains for stations

Post by Molay »

Looking forward to that day, boskid :)

MiniHerc
Fast Inserter
Fast Inserter
Posts: 176
Joined: Fri Jun 26, 2015 11:37 pm

Re: Request: Max number of trains for stations

Post by MiniHerc »

I don't really see the problem here.

Suppose a train stop is set to allow 1 2-4 train to path there, with enabled condition of ore > 8000. There are 4 trains waiting in a stacker near the ore unload. The train stop opens up, and one train paths there. The other three wait, since the limit of 1. The train loads up on ore and heads to unload, and the train stop still has 10k ore left, so a second train heads there once the first leaves. After that one leaves, there is 5k ore left, so the two trains heading to unload resume after in the stacker and no additional trains leave the stacker.

No deadlocks / jams / what have you.

Why is this not already a feature? I could have really used it in my latest vanilla playthrough...

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

Re: Request: Max number of trains for stations

Post by ssilk »

Just want to mention that there is also an existing suggestion thread here viewtopic.php?f=6&t=81682
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Request: Max number of trains for stations

Post by foamy »

boskid wrote:
Thu Jun 11, 2020 9:36 am
Maybe some day
Please! It would be an enormous QoL improvement.

EDIT:

Especially if it were smart enough to pull the trains with the least pathfinding distance first.

User avatar
ptx0
Smart Inserter
Smart Inserter
Posts: 1507
Joined: Wed Jan 01, 2020 7:16 pm
Contact:

Re: Request: Max number of trains for stations

Post by ptx0 »

foamy wrote:
Sun Jun 21, 2020 8:06 pm
boskid wrote:
Thu Jun 11, 2020 9:36 am
Maybe some day
Please! It would be an enormous QoL improvement.

EDIT:

Especially if it were smart enough to pull the trains with the least pathfinding distance first.
sounds like a waste of CPU cycles.

User avatar
Illiou
Long Handed Inserter
Long Handed Inserter
Posts: 79
Joined: Wed Feb 27, 2019 9:35 pm
Contact:

Re: Request: Max number of trains for stations

Post by Illiou »

ptx0 wrote:
Wed Jun 24, 2020 11:56 pm
foamy wrote:
Sun Jun 21, 2020 8:06 pm
boskid wrote:
Thu Jun 11, 2020 9:36 am
Maybe some day
Please! It would be an enormous QoL improvement.

EDIT:

Especially if it were smart enough to pull the trains with the least pathfinding distance first.
sounds like a waste of CPU cycles.
You mean like right now? Because right now they're all pathing there...

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Request: Max number of trains for stations

Post by foamy »

ptx0 wrote:
Wed Jun 24, 2020 11:56 pm
sounds like a waste of CPU cycles.
The additional load of doing a single pass through the results of the (already running) pathfinder algo to find the minimum one is so inconsequential that it isn't worth mentioning.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2888
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Request: Max number of trains for stations

Post by boskid »

foamy wrote:
Thu Jun 25, 2020 3:20 pm
The additional load of doing a single pass through the results of the (already running) pathfinder algo to find the minimum one is so inconsequential that it isn't worth mentioning.
Please keep in mind that pathfinder is implemented to search from a single train to multiple train stops, proposed part goes into "search from single train stop into multiple trains in reverse" and would require copying trains pathfinder and modifying it a lot. There would be also some amount of issues related to penalties as to when to apply them, or which ones should be applied at all.

Also what would be a benefit of finding train that has least distance to a given train stop? what if that train would not want to repath to us since it already has a train stop goal that is closer from its point of view?

foamy
Filter Inserter
Filter Inserter
Posts: 432
Joined: Mon Aug 26, 2019 4:14 am
Contact:

Re: Request: Max number of trains for stations

Post by foamy »

boskid wrote:
Thu Jun 25, 2020 3:36 pm
Also what would be a benefit of finding train that has least distance to a given train stop? what if that train would not want to repath to us since it already has a train stop goal that is closer from its point of view?
The benefit specifically is so that, should a stop open up, the train that goes to it comes from, e.g., it's stacker, and not from half-way across the base. The current behaviour has both trains path, but because the one in the stacker is closer, it arrives first and so the problem doesn't arise. If they are reserving slots in a non-pathweighted fashion, i.e. by ID or some other internal ordering, then the one in the stacker might wait on a long-distance train. That's obviously undesired behaviour.

The exact implementation details I can't speak to, but I would think that since each station already knows every train that has it in its schedule there is at least some way for the game to pull 'a list of all trains that have this stop', and from there 'a list of all trains that have this stop as its current destination' -- stops might have the same name but they are presumably disambiguated within the internals of the game.

So my thought on the flow would be:

1. On a train repath, the train does its usual find-a-valid-station checks. For each pathable station it finds, it saves the pathfinding weight to get there. It presumably already does something similar to this in order to travel to the nearest open station as it currently does.
2. Each train then tries to register with its nearest station its intent to go there, and reports its pathweight. The station, up to its train limit, will take those and report back 'yes you can path to me' or 'no you can't', in order from lowest pathweight ('nearest') to highest pathweight ('furthest').
3. If a train gets a 'no' back from a station, it moves up to the next one in its list, and requests again.

The heavy load, the pathing, I don't think is any more intensive than at present. The train-limit check and pathweight checks are simple integer comparisons and even done repeatedly should be functionally instant.

There might be some additional stuff to address trains not repathing away from a station they're pathing to just because a closer train is now available to path to it and gets in first. That'll depend on desired behaviour.

User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 251
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Request: Max number of trains for stations

Post by Nosferatu »

Why should there be a train in the stacker that is waiting for a slot?
If your stations trainlimit is 1 then trains won't need the stacker.
If it's higher then all train waiting inside the stacker already have reserved their slot.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2888
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Request: Max number of trains for stations

Post by boskid »

Even if this approach would be benefitial, i do not want it.
1/ It still needs some estimate of path cost for all trains that are heading for given station but other train stop. Extra pathfinder that would work in opposite direction.
2/ issue would happen only when a stacker has its own train stop trap (probably with limit set to reduce amount of trains heading to stacker). It would be possible to design loading/unloading in a way that trains heading to load/unload would park in stacker but with a path to the station directly. That way train in stacker would already be assigned to some train stop so would be the first one to arrive, and this would still allow changing train stop when other one would not be full
3/ It would also be possible in other way with CN magic: when an unload/load train stop is not full, by CN force some trains in stacker to repath by reducing limit of trains in stacker.

Corner case for pulling trains to a given train stop would be long rail segment with junction and 2 train stops with same name and equal penalty, both set with limit of 1. When train would repath from train stop A to train stop B, A would become non-full and would want to repath some train to it. This would force train to go to train stop A and now train stop B is non-full. I want to avoid such loops.

Post Reply

Return to “General discussion”