Page 1 of 1

Why do trains get stuck at this chain signal?

Posted: Fri Dec 09, 2016 9:11 pm
by thatguy321
I have a train station layout with multiple train stops of the same name ("Iron Smelting"). I have combinators hooked up so that the signal leading to the lane with the least amount of ore will be green and the rest red which will always force the trains to unload at the station with the least amount of ore. Unless the station with the least amount of ore currently has a train at it, then they will turn the signal green going to the station with the second least amount of ore, etc.

This system worked flawlessly while I was running it with 8 lanes. But I have expanded it to 20 or so lanes and now every so often a train will get stuck at the chain signal seen in the pics. It will be working fine and randomly a train will get stuck there. As you can see from the pic, the chain signal is blue indicating that there is an open lane ahead and indeed you can see that bay N has a green signal. Why won't the train go? Thanks!

Re: Why do trains get stuck at this chain signal?

Posted: Fri Dec 09, 2016 9:58 pm
by MalcolmCooks
see this topic for a solution: viewtopic.php?f=18&t=34321

Re: Why do trains get stuck at this chain signal?

Posted: Sat Dec 10, 2016 3:36 pm
by Fish
Yeah, this is annoying
I hope they do a rework of train pathfinding

Re: Why do trains get stuck at this chain signal?

Posted: Sun Dec 11, 2016 10:56 am
by MalcolmCooks
Fish wrote:Yeah, this is annoying
I hope they do a rework of train pathfinding
The fix could be as simple as having trains recalculate their path when they stop at a chain signal :/

Re: Why do trains get stuck at this chain signal?

Posted: Sun Dec 11, 2016 2:59 pm
by mexmer
MalcolmCooks wrote:
Fish wrote:Yeah, this is annoying
I hope they do a rework of train pathfinding
The fix could be as simple as having trains recalculate their path when they stop at a chain signal :/
which will not work.

mind that if there is multiple signals (crossing), after then you don't know which one of them will change color of signal you stop at. so what you want to recalculate? path to free station? but what if in that time comes other train, from different direction?

recalculation of path, whem you pass signal is one of best approaches you can have (unless you plan to make heuristic logic network).

Re: Why do trains get stuck at this chain signal?

Posted: Thu Dec 15, 2016 9:21 pm
by thatguy321
MalcolmCooks wrote:see this topic for a solution: viewtopic.php?f=18&t=34321
Thanks for the link, that sheds some light on what each train is "thinking". I didn't know any of that before. That faux chain signal doesn't quite work for my design though. I want the trains to pick the station which has the least amount of ore in its buffer in order to keep things balanced out, but they always pick whichever station they feel like even if I make the signal before the station go red and they have another route to get to a station where the signal is green. In fact even if you don't want to balance out the stations, how do you get a large amount of trains to unload simultaneously without having different station names? It seems to me that if you have more than 10 or so stations of the same name, the trains will just end up parking behind a station which is already unloading a train leaving multiple other stations empty and idle.

Any thoughts? Solutions?

Re: Why do trains get stuck at this chain signal?

Posted: Thu Dec 15, 2016 9:55 pm
by thatguy321
Ok, one thing I think I just found out is that trains seem to look for a route that is all green, however, they will treat a signal which you have artificially turned red via circuit conditions as a green light (yes, they will stop at it, but they don't factor it into their route planning)! They seem to treat a signal that is red because a train is in the way differently than a signal which you have set to red.

Re: Why do trains get stuck at this chain signal?

Posted: Fri Dec 16, 2016 11:02 am
by Deadly-Bagel
Pretty sure the train has no idea why a signal is red. It might be if you're setting them both in the same tick? I would set the stations and faux-signal separately, let the faux-signal work based solely off the colour of the lights rather than any other logic.

Connect the faux-signal on say a green network, then you'll want to set up a separate circuit (connect the signals with red wires) across the loading bays that enables access to only an empty station with the least amount of ore. Easiest way is like a loading station, enable any station that is equal or less than average. To enable JUST one station, see this Reddit post, seems to do what you want, just remember to keep it separate from the faux-signal.