How to use the train limit with double headed trains/stations
Posted: Tue Oct 05, 2021 8:17 pm
I'm going to play on a ribbon world with double headed trains. The station design is such that I have 2 tracks each at the top and bottom of the map and the train stations go from top to bottom. And bottom to top. Each station has 2 train stops so trains can enter from the top or bottom.
Now this causes a problem with the train stop limit. Each station can only allow one train and chain signals ensure that only one train ever enters a station. I also set each train stop to 1 train only. But one train can target the top stop and another the bottom stop of the same station.
So how do I tell the game that I have 2 stops that make up a train station and for the station all together the train limit is 1?
The solution I'm trying now is to have each stop output the train count (top as C, bottom as D) and enable the other station if D=0 or C=0 respectively. So if a train targets the top station the bottom gets disabled. Seems to work so far. But what if trains target the top and bottom stations in the same tick? Then next tick both stations get disabled. Next tick the trains don't target the stations anymore so both stations get enabled. And then both trains will target both stations again. I'm afraid that the trains will get into a state where both stops of a station will toggle on/off every tick.
I made a little test setup with two trains fighting over the stations:
Place the blueprint, fuel up the trains and then turn on the constant combinator and watch the trains stutter along till one reaches the station. After that the trains will alternate. This would absolutely kill my game.
I can fix this by having the bottom stop turn back on with 1 tick delay. Takes an extra combinator per station and trains still stutter a bit but then settle down:
Any other ideas for making the train limit work for double headed stations with 2 stops?
Now this causes a problem with the train stop limit. Each station can only allow one train and chain signals ensure that only one train ever enters a station. I also set each train stop to 1 train only. But one train can target the top stop and another the bottom stop of the same station.
So how do I tell the game that I have 2 stops that make up a train station and for the station all together the train limit is 1?
The solution I'm trying now is to have each stop output the train count (top as C, bottom as D) and enable the other station if D=0 or C=0 respectively. So if a train targets the top station the bottom gets disabled. Seems to work so far. But what if trains target the top and bottom stations in the same tick? Then next tick both stations get disabled. Next tick the trains don't target the stations anymore so both stations get enabled. And then both trains will target both stations again. I'm afraid that the trains will get into a state where both stops of a station will toggle on/off every tick.
I made a little test setup with two trains fighting over the stations:
Place the blueprint, fuel up the trains and then turn on the constant combinator and watch the trains stutter along till one reaches the station. After that the trains will alternate. This would absolutely kill my game.
I can fix this by having the bottom stop turn back on with 1 tick delay. Takes an extra combinator per station and trains still stutter a bit but then settle down:
Any other ideas for making the train limit work for double headed stations with 2 stops?