Page 1 of 1

[0.8.5] Train Pathfinding Issue

Posted: Fri Jan 03, 2014 3:57 pm
by Telarin
This is somewhere between a defect and a suggestion, so feel free to move it, but I felt it was more of a defect myself, so posted it here.

I constructed the following structure, with the hopes of allowing multiple trains to share a single long section of track without having to wait for the entire length to clear before proceeding, basically building a passing siding (common in real world railroad systems):

Image

Expected behavior:
Train A approaches from the west on track section 1, while at the same time Train B is approaching from the east on Track 4.
Train A enters Track 3, causing the signal light for this section to turn red
My expectation is that at this point, Train B would proceed on Track 2, allowing the two trains to pass, however, Train B simply pulls up at the signal light for Track 3, causing a deadlock

Suggested fixes:
1) Have trains recalculate their route each time they reach a switch, this would allow them to make a decision regarding blocked tracks, and hopefully pick an alternate path if one is available
2) Have all trains recalculate their routes each time the status of a section of track changes. This seems like it would end up being a lot more CPU intensive in large rail systems, but might work better for busy systems.

Re: [0.8.5] Train Pathfinding Issue

Posted: Fri Jan 03, 2014 4:02 pm
by kovarex
I personally solve this by having the 2 + 3 section one-directional.
Lets say you allow just east direction to 2 and west to 3 and it will work correctly (I used it this way in my games)

Re: [0.8.5] Train Pathfinding Issue

Posted: Fri Jan 03, 2014 5:32 pm
by Telarin
Yeah, that sounds like a reasonable workaround. How do you go about making a section one-way?

Re: [0.8.5] Train Pathfinding Issue

Posted: Sat Jan 04, 2014 4:40 pm
by Nirahiel
Place signals posts only on the right of the one way section :)

Re: [0.8.5] Train Pathfinding Issue

Posted: Sat Jan 04, 2014 7:58 pm
by ssilk
I think this is not a bug. But it should be explained much better in the docs, because it is quite difficult to understand.

Re: [0.8.5] Train Pathfinding Issue

Posted: Tue Jun 17, 2014 3:01 pm
by slpwnd
Technically this is not a bug. Though the suggestions made are valid. Trains path recalculation should be more elaborate than it is now so trains can deal with situations like this. This is something we want to add for sure, but this topic belongs to ideas & suggestions (so moving it there).

Using one direction only lines as suggested by others is a solution for now.

Re: [0.8.5] Train Pathfinding Issue

Posted: Tue Jun 17, 2014 4:55 pm
by sillyfly
kovarex wrote:I personally solve this by having the 2 + 3 section one-directional.
Lets say you allow just east direction to 2 and west to 3 and it will work correctly (I used it this way in my games)
So - if I understand correctly (after a few tests) - a signal on one side is regarded as if the other side has a signal which is constantly red?
This need to be documented somewhere! I always assumed if there is no signal in the direction the train is moving - it can always go! (i.e. - a signal in one direction is equivalent to a signal in the other direction being constantly green )

Re: [0.8.5] Train Pathfinding Issue

Posted: Tue Jun 17, 2014 9:32 pm
by arl85
sillyfly wrote:
kovarex wrote:I personally solve this by having the 2 + 3 section one-directional.
Lets say you allow just east direction to 2 and west to 3 and it will work correctly (I used it this way in my games)
So - if I understand correctly (after a few tests) - a signal on one side is regarded as if the other side has a signal which is constantly red?
yes, it's quite natural for who played OTTD: a signal can only be passed from the side with the lights and never from its back.

quoting their wiki:
OTTD Wiki wrote:Although the one-way (block) signal appears there is only one side of the signal facing the passing direction, technically speaking, the disappeared signal of the other side still exists and is red permanently to block the entrance from that side

Re: [0.8.5] Train Pathfinding Issue

Posted: Wed Jun 18, 2014 4:18 am
by ssilk
On our wiki: Pass by stations