How to make trains pick an open waiting bay

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

How to make trains pick an open waiting bay

Post by aober93 »

So i have trains arriving at a station. WIth 2 parallel waiting bays in case the station is full. But i have the situation that i cannot solve trains not picking the open waiting bay. But instead they ignore it. See the attached image.
The selected train is waiting on a chain signal. And it has a free waiting bay to go into, it wont do it. Why?
Thanks
trainsetup2.jpg
trainsetup2.jpg (195.51 KiB) Viewed 7333 times

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

I don't normally have a problem with this, however I don't see why you would need a chain signal there. Would a normal signal not suffice?

Also is that a signal behind the train just leaving the waiting bay? Can't quite see but I assume so otherwise the other signals' status wouldn't make sense.
Money might be the root of all evil, but ignorance is the heart.

kinnom
Filter Inserter
Filter Inserter
Posts: 706
Joined: Fri Dec 26, 2014 4:20 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by kinnom »

strange, the trains should prefer the upper waiting bay over the middle one, as it is shorter. what happens if you remove a rail from the middle waiting bay?
no yes yes no yes no yes yes

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

I dont know if im supposed to put the chain signal. But with a normal signal or none, the train sometimes runs into the full waiting bay. But since im trying to avoid that, i dont know what i should do.

If i remove a rail segment from the occupied bay, the train goes into the free bay. What does this help me?

Also if i place another signal on the free bay, the train will immidiatly go into it.

And yes there is a normal signal at the end of each waiting bay.

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

Well now i know how to trigger it.

If all waiting bays are full, and another train is waiting before the bays on that chain signal, it will already have decided on a bay but is waiting. But if the other bay empties first, the train will not change mind, and i have the situation seen on the picture. The train not going into the free bay.

Perhaps this was because i manually emptied the bays?

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

Ah, I see. Yes that would probably do it, are routes only calculated when a signal is passed? That would make sense, a train sitting there waiting probably isn't going to want to check every tick for a better route, that would stack up quickly on big networks.

Not sure there's a way around this other than to ensure you have as many waiting bays as trains...

EDIT:

You could probably use the circuit network. Instead of a chain signal use a normal signal that is active only if there is a free bay. Once all bays are full the signal is disabled. I think this should cause trains to then pass it and recalculate to find the empty bay.
Money might be the root of all evil, but ignorance is the heart.

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

Occasional updates in pathfinding wouldnt be a problem or? Ok well i think i leave this as it is. It happens in automatic too, that a bay empties first which another train ignores. Will add more waiting bays then if its becoming a problem. That seems like the easiest fix to me.

I removed the chain signal at the entrance because it doesnt help. Hopefully the devs add a way for trains to recheck the route once per second or so.

mooklepticon
Fast Inserter
Fast Inserter
Posts: 239
Joined: Wed Mar 02, 2016 10:09 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by mooklepticon »

I've heard that trains pick their path the moment they leave their originating station. If there's something in the path, they just wait for it to clear, even if there's an alternate. The proposed solution is to put a 0-second station stop at the entrance of the area, so it'll path to the entrance of the waiting bays and then, at the last second, actually choose an open bay.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

If I can get online tonight I'll run some tests.
Money might be the root of all evil, but ignorance is the heart.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

Tested my theory and it works:
Train Circuit
Ignore the combinator, it was for testing. The three "bay" signals send their status to the logistic network, and the "pre-bay" signal has a condition [Green] = 0 which disables the signal if there are any green signals on the network. This means as soon as a bay becomes available it goes green and should allow the train to proceed.

However I can't replicate the problem even with your setup??? Once a bay becomes available the train happily parks in it, might be a fringe condition. Try the circuit and see how you go, easy to set up.

EDIT: Huh... I ran your setup for a few minutes and it suddenly did the same thing, chain signal went blue but the train is still parked ignoring the free bay... weird... and now it replicates consistently. Replaced with circuit and now running fine.
Last edited by Deadly-Bagel on Wed Dec 13, 2017 4:25 pm, edited 2 times in total.
Money might be the root of all evil, but ignorance is the heart.

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

Wish this worked. I cannot place 2 manual trains in the bays in my example, because i also have another route into the station. So the trains take a detour. And in automatic mode it sticks to the occupied bay.

Additionally manual intervention has this work for me most of the time. Because manual intervention seems to trigger pathfinding. That is driving the trains manually, blocking the route by placing a waggon or removing a rail or placing additional signals.


Ahh! "Passing a train signal" also trigger the pathfinding. I noticed this occasionally when i placed a lot in front of the branch to the bays. So i figured why your setup didnt work for me. I set the signal too close before the branching rail. The second the train left the signal, it was already branching of into its predestined bay. So i just set your signal a bit before the branching, and now it seems to work.
And now i know why the chain signal i tried yesterday doesnt work. Its because the train isnt technically passing the signal for it to recalculate pathfinding.

So all your setup does, is make the train "pass" a signal once a bay opens, and passing a signal makes it retrigger pathfinding. And thus make the train pick the free bay. You have to place the signal at least 2 units before the branching for it to work.
This is not exactly intuitive, wish i knew it earlier. So your setup works, just put the presignal 1 unit earlier!

Edit: well no it still doesnt work occasionally. But it does work most of the time. Perhaps why it doesnt work sometimes is because pathfinding is wrong. I have a 4way station, and the error only happens on one of them. Thus i guess its the pathfinding doing it wrong.
Last edited by aober93 on Fri Sep 02, 2016 11:14 am, edited 4 times in total.

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

Deadly-Bagel wrote:Tested my theory and it works:
By the way. The reason your exact setup (in the picture) works is because you do manual control of trains. Your presignal is too close to the branching for it to work in automatic mode. So if you ran automatic it would stop working occasionally. Put the signal 1 unit earlier and it works.

Edit: or maybe it is already i cant tell from the low resolution. But my point is, if its directly in front of the branch it doent work in automatic, but because of manual controls.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

Unfortunately shortly after taking that video the game crashed but I made another setup and tested it for a few minutes (well past long enough for it to break with a chain signal) on auto mode and didn't have any problems, though I think the signal was a bit further from the split rails because it was late and I was just throwing things down.

Yeah resolution is bad but the video file was some 300MB and even that quality the GIF came out at 30MB. Optimised it today down to 8MB, still pretty chunky. Gets the point across anyway, and good that you've got it working ^_^
Money might be the root of all evil, but ignorance is the heart.

aober93
Filter Inserter
Filter Inserter
Posts: 453
Joined: Tue Aug 30, 2016 9:07 pm
Contact:

Re: How to make trains pick an open waiting bay

Post by aober93 »

Yea thanks! However seems i have triggered a bug, which corrupted my savegames by wiring up signals. And 200 hours gone to shit. Find my bug report =(((

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

Ahah I saw that earlier but didn't realise it was this you were trying to do xD
Money might be the root of all evil, but ignorance is the heart.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: How to make trains pick an open waiting bay

Post by Deadly-Bagel »

I'm not able to replicate either the crash (though I'm playing in sandbox, might be something to do with it) or the problem where the signal is too close. I've been running five trains around a loop with three bays for the last five minutes and it doesn't matter how close I put the signal to the branch, it doesn't break. EDIT: ran it for around half an hour, all trains set to visit both stations for 5 seconds, still didn't break.
Train Loop
Money might be the root of all evil, but ignorance is the heart.

Post Reply

Return to “Gameplay Help”