Page 1 of 2

Add double headed train stops

Posted: Thu Oct 07, 2021 7:00 pm
by mrvn
TL;DR
Add train stops that can be approached from either direction.

What ?
I suggest adding a train stop entity that trains can approach from either direction.
double-stop.png
double-stop.png (60.08 KiB) Viewed 4172 times
double-stop2.png
double-stop2.png (29.01 KiB) Viewed 4172 times
The double headed train stop should be placable between wagons and 1x4 tiles big or 2x2 so it doesn't collide with inserters or big chests or bulk rail loaders from mods. It could be either an arch like 2 normal train stops combined or just a little box in the middle of the tracks, which would fit a 2x2 size better and could keep the 2 tile alignment of rails.

The aim of the double headed train stop is to be a waypoint, not the actual station, because of where trains would stop relative to the double headed trainstop.

Can the circuit connection for the little box version be at the outside of the tracks on both sides? Would allow placing the wires so the train doesn't drive over them. Or can there only be one place per entity where each wire connects?
Why ?
When playing with double headed trains one can either have terminal stations where a train drives in one way and leaves the other way. Or one can have stations where trains can enter and leave from either direction. The later requires placing train stops on both sides of the tracks so the train stops between the two regardless of which direction it comes from. That works well until one wants to add a train limit to the stops. For example train limit = 1. Because you really don't want a train coming in the way the already present train wants to leave.

The addition of a double headed train stop would allow placing them in the middle of the station as a waypoint. Circuit logic can then be used to allow 1 train to target the waypoint and then set the train limit to 0 until the train has left the station so no other train uses the same waypoint till it is clear again.

This can't be done with 2 separate train stops on opposite sides of the track as the decision must be atomic or trains stutter and can eventually block traffic. For a discussion of that problem see viewtopic.php?f=18&t=100181

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 5:29 am
by JimBarracus
I know its nice to solve puzzles,
but you are creating a problem, that does not need to exist.

There are plenty of conventional solutions that would not create such a problem in the first place.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 10:21 am
by mrvn
JimBarracus wrote:
Fri Oct 08, 2021 5:29 am
I know its nice to solve puzzles,
but you are creating a problem, that does not need to exist.

There are plenty of conventional solutions that would not create such a problem in the first place.
If you mean not using double headed stations than no thanks. Otherwise please add it to viewtopic.php?f=18&t=100181

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 11:15 am
by UkcsAlias
The thing is, both trainstops generaly provide diffirent purposes as depending on direction, the train stops at a diffirent side. Even with a double stop, you need to know which side the train needs to stop at. So you still end up with 2 diffirent stops. And they idealy should get 2 diffirent names with it (otherwise a train can just take the other side if the network allows that).

A single stop for 2 sides just adds too much UI clutter. Its a bad idea to merge the stops. It only makes it easier to create a problem, rather than solving it. And promotes creating such 'mess' as a situation, just because it exists.

But i do know 1 situation in which you do want the double direction, and that is when a train simply has to pass through. In which case the other side of the trainstop could be a signal. But even here, i think its better to promote splitting the track in order to avoid blocking trains.

So im against this idea. Its better to teach players a more clean approach, and just let them face the struggle of this. It should get them to realize faster that its a bad idea to do it like that.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 11:30 am
by mrvn
UkcsAlias wrote:
Fri Oct 08, 2021 11:15 am
The thing is, both trainstops generaly provide diffirent purposes as depending on direction, the train stops at a diffirent side. Even with a double stop, you need to know which side the train needs to stop at. So you still end up with 2 diffirent stops. And they idealy should get 2 diffirent names with it (otherwise a train can just take the other side if the network allows that).

A single stop for 2 sides just adds too much UI clutter. Its a bad idea to merge the stops. It only makes it easier to create a problem, rather than solving it. And promotes creating such 'mess' as a situation, just because it exists.

But i do know 1 situation in which you do want the double direction, and that is when a train simply has to pass through. In which case the other side of the trainstop could be a signal. But even here, i think its better to promote splitting the track in order to avoid blocking trains.

So im against this idea. Its better to teach players a more clean approach, and just let them face the struggle of this. It should get them to realize faster that its a bad idea to do it like that.
Did you miss the part about the double headed train stop being for waypoints? That's exactly what I suggested.

As for the double headed stations themself: They do need 2 stops with the same name placed such that the train stops at the same place regardless which stop it uses. Having the train choose which stop to take and from which direction to approach is the whole point of a double headed station and giving the stops different names would mean you have to decide which direction a train must drive via the schedule. That's contrary to the idea. Stops look like this:
stop.png
stop.png (320.88 KiB) Viewed 4105 times
No matter which stop the train takes it ends up in the same location. This is my train depot where trains idle and are refueled. But for the train limit to really work for these stops they need a double headed train stop as waypoint placed between the two stops.

And no, you can not put a stop on one side and a signal on the other. That would make A) the train only approach the stop from on direction and B) make the track uni directional the other way. So you just created an instant deadlock.


As for UI clutter? What are you talking about? The UI for a double headed stop would be no different than a normal stop. It's really just a different graphic and internally allowing trains to approach the stop from either side while having an atomic train counter.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 1:54 pm
by UkcsAlias
So basicly instead of it actualy being trainstops, you effectively want to have named signals so you can force routes of trains more accurately? A new structure for this could indeed help.

I still think bidirectional stops are a bad idea. But on that, could it help if the train stops also show the information of trains of nearby stops. So you can accurately align the new stop with the existing one to enforce it being bidirectional and have alignment. That way you do not effectively discourage it, but also do not encourage it, but at least add some QoL to building it.
Allowing dynamic length still doesnt work then, but i dont see an issue there, as this sounds to me like a situation which is strictly controlled by the player anyway.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 2:35 pm
by mrvn
UkcsAlias wrote:
Fri Oct 08, 2021 1:54 pm
So basicly instead of it actualy being trainstops, you effectively want to have named signals so you can force routes of trains more accurately? A new structure for this could indeed help.
I'm just calling it a train stop because that's what you can put in a train schedule. It really should only ever be a waypoint. Call the entity a waypoint while internally it is still a train stop or very similar to it.
UkcsAlias wrote:
Fri Oct 08, 2021 1:54 pm
I still think bidirectional stops are a bad idea. But on that, could it help if the train stops also show the information of trains of nearby stops. So you can accurately align the new stop with the existing one to enforce it being bidirectional and have alignment. That way you do not effectively discourage it, but also do not encourage it, but at least add some QoL to building it.
Allowing dynamic length still doesnt work then, but i dont see an issue there, as this sounds to me like a situation which is strictly controlled by the player anyway.
When placing a train stop you already get the white boxes where wagons will be. It's pretty easy to align that so the stop on the other side falls between 2 wagons and then the alignment works both ways. Building it is no problem. Using it without train limit is also no problem. Just the train limit doesn't work right because the limit should be counted for both stops.

Note: This only works for trains with odd length, 1, 3, 5, ... You can't get a train with even length to align.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 2:57 pm
by netmand
This looks like a bi-directional stop to me. From my perspective it would be a challenge to use because the load/unload area would be obfuscated: I would need to replicate the loading or unloading devices on both sides. Also, I believe a waypoint would be best served from a single-direction station.

The problem you presented in the OP is easily solved with two stations that disable the other when a train is stopped at one.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 4:03 pm
by mrvn
netmand wrote:
Fri Oct 08, 2021 2:57 pm
This looks like a bi-directional stop to me. From my perspective it would be a challenge to use because the load/unload area would be obfuscated: I would need to replicate the loading or unloading devices on both sides. Also, I believe a waypoint would be best served from a single-direction station.

The problem you presented in the OP is easily solved with two stations that disable the other when a train is stopped at one.
Not, it is not. see the mentioned thread for all the problems that causes.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 5:31 pm
by netmand
mrvn wrote:
Thu Oct 07, 2021 7:00 pm
This can't be done with 2 separate train stops on opposite sides of the track as the decision must be atomic or trains stutter and can eventually block traffic.
This is not solely a problem about multiple train stops. This is the challenge of double-headed trains in general.

The real problem is that you want to specify the stop where the cargo goes not the loco. I agree with this but it is not how the game was made.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 7:06 pm
by mrvn
netmand wrote:
Fri Oct 08, 2021 5:31 pm
mrvn wrote:
Thu Oct 07, 2021 7:00 pm
This can't be done with 2 separate train stops on opposite sides of the track as the decision must be atomic or trains stutter and can eventually block traffic.
This is not solely a problem about multiple train stops. This is the challenge of double-headed trains in general.

The real problem is that you want to specify the stop where the cargo goes not the loco. I agree with this but it is not how the game was made.
The problem is that I want to set a train limit for a double headed station. It doesn't even need double headed trains. The same problem arises with single headed trains if you still have double headed stations. Factorio has no concept of a station being made up of multiple stops and you can't fake that because the train count has to be atomic.

Re: Add double headed train stops

Posted: Fri Oct 08, 2021 7:53 pm
by netmand
mrvn wrote:
Fri Oct 08, 2021 7:06 pm
The problem is that I want [...] a double headed station. [...] Factorio has no concept of a station being made up of multiple stops [...].
clippy clippy, sorry for the snips but making a point in your own words.

..and there's no such thing as a double-headed station hence the suggestion that one is added; I get that. It seems to me that adding a station type that can be approached from either direction creates more problems than it solves.

Hence my observation that what is actually wanted is a station that marks where the cargo wagons stop instead of where the locomotives stop. yes? no?

Re: Add double headed train stops

Posted: Sat Oct 09, 2021 12:48 am
by mrvn
The game actually already has double headed train stops: The temporary stops. So I'm really just asking for permanent temporary stop. :)
temp-stop.png
temp-stop.png (1.47 MiB) Viewed 4032 times

Re: Add double headed train stops

Posted: Sat Oct 09, 2021 2:53 am
by Shaylexios
I had a thought, instead of double headed train stops, be able to link 2, or more, stops together with circuits so that if one has inbound the other cannot?

Re: Add double headed train stops

Posted: Sat Oct 09, 2021 5:18 am
by ssilk
When I think about how much has been written to understand the use case of this (it’s still quite curious for me :) ), and when I combine that with how much users struggle with trains, I’m sure this has only a very, very low chance of being implemented. 8-)

In other words: The added game-value is quite low (hm, I admit, I play nearly no double headed trains, perhaps that’s the reason why I don’t understand this), and the added complexity is really high, as this discussion shows.

Re: Add double headed train stops

Posted: Sat Oct 09, 2021 12:43 pm
by mrvn
ssilk wrote:
Sat Oct 09, 2021 5:18 am
When I think about how much has been written to understand the use case of this (it’s still quite curious for me :) ), and when I combine that with how much users struggle with trains, I’m sure this has only a very, very low chance of being implemented. 8-)

In other words: The added game-value is quite low (hm, I admit, I play nearly no double headed trains, perhaps that’s the reason why I don’t understand this), and the added complexity is really high, as this discussion shows.
All of this applies to single headed trains too. A bidirectional station works for single headed trains just as well and is more compact than having to add turn arounds. You can add refueling stations between uni directional tracks if they have enough distance like this:
inline-refueling.png
inline-refueling.png (1.21 MiB) Viewed 3992 times

Re: Add double headed train stops

Posted: Mon Oct 11, 2021 7:15 am
by ssilk
I don’t understand why I should do this.
I have no problem to build two refuel stations, one for each direction — if I ever need it.
Or I place two stops with the same name. Quite easy to understand, because it is similar to reality. Your idea has no equivalent in reality (AFAIK).

Re: Add double headed train stops

Posted: Mon Oct 11, 2021 3:35 pm
by mrvn
In reality the train driver just backs up into the fueling station. Can't do that in factorio. So not really seeing an argument there.

As to why I would do something like that? Saves me half the buffer of fuel. Also because I can. The refueling stop was just the first example I could remember I had so I could make a quick screenshot with a single headed train.

I still hope you might implement this. I mean the code must be nearly all there already for the temporary stops. It would just be a matter of adding a condition to the code that removes temporary stops to not do that if it is a waypoint entity.

Re: Add double headed train stops

Posted: Mon Oct 11, 2021 6:32 pm
by Nosferatu
Shaylexios wrote:
Sat Oct 09, 2021 2:53 am
I had a thought, instead of double headed train stops, be able to link 2, or more, stops together with circuits so that if one has inbound the other cannot?
This ^^ - but I would say they should be linked and then "share" their train limit.

A lot easier to use then OPs suggestion and it could have uses in other situations.
For example creating a station for different trainlengths (Example a stop for LLLCCCC trains and a stop for LCCCC which share their inserters)

Re: Add double headed train stops

Posted: Tue Oct 12, 2021 3:35 pm
by mrvn
Nosferatu wrote:
Mon Oct 11, 2021 6:32 pm
Shaylexios wrote:
Sat Oct 09, 2021 2:53 am
I had a thought, instead of double headed train stops, be able to link 2, or more, stops together with circuits so that if one has inbound the other cannot?
This ^^ - but I would say they should be linked and then "share" their train limit.

A lot easier to use then OPs suggestion and it could have uses in other situations.
For example creating a station for different trainlengths (Example a stop for LLLCCCC trains and a stop for LCCCC which share their inserters)
Sure, that would be great too. I assumed that was a no go as it would be more complex. It would require some way to link stations which is a concept factorio doesn't have. Would you connect them with copper/red/green wire? It also would require the train limit integer in the train stop to be a pointer to a shared integer changing all the code that accesses it. And then you have to deal with that for blueprints and ghosts as well, more changes.


As for a station for LLLCCCC and LCCCC trains. You could just place the waypoint before the LCCCC stop. It's basically the same as a double headed station for symetrical trains.