Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trains zig zag on bi-directiona tracks #1486

Closed
kianzarrin opened this issue Mar 22, 2022 · 3 comments · Fixed by #1487
Closed

Trains zig zag on bi-directiona tracks #1486

kianzarrin opened this issue Mar 22, 2022 · 3 comments · Fixed by #1487
Assignees
Labels
BUG Defect detected LANE ROUTING Feature: Lane arrows / connectors triage Awaiting issue categorisation
Milestone

Comments

@kianzarrin
Copy link
Collaborator

kianzarrin commented Mar 22, 2022

based on: #1483 (comment)

For each lane transition routing manager calculates distance between similar lane index between the two lanes.
Similar lane index for bidirectional train tracks can flip if you reverse the segment placement.
Therefore, if you reverse the placement of bidirectional train network, then trains will PREFER to zigzag on middle nodes (to minimize cost of transition) even though all lane transitions will be created.

image
in the picture I have used 3 bidirectional segments between the two train stations. the middle one is placed at reverse direction. That is why the trains would prefer to zigzag. I also have forced a node in the middle. if you zoom in you notice all lane transitions are created but the preferred transition is the zigzagged one.

in such circumstances:

  • for middle nodes, only one transition should be created.
  • for other nodes all transitions should be created but the distance should compare inner/outer similar lane index (I think this would work but I have not tested it).

Also we need to look at the code to see if there is any other situations in which we might compare inner/outer similar lane index.

@kianzarrin kianzarrin added BUG Defect detected triage Awaiting issue categorisation labels Mar 22, 2022
@kianzarrin kianzarrin self-assigned this Mar 22, 2022
@kianzarrin kianzarrin added the LANE ROUTING Feature: Lane arrows / connectors label Mar 22, 2022
@kianzarrin
Copy link
Collaborator Author

I used this AN asset to test lane transitions:
train-tracks-2x2-bi.zip

@kianzarrin
Copy link
Collaborator Author

Damn it gets even more confusing when unidirectional is connected to bidirectional track.

@kianzarrin
Copy link
Collaborator Author

what if A) "vanilla 2x2 train station" connects to B) "normal vanilla 2x2 train network"?
A) both lanes have similar lane index of 0 (because one of them is avoid forward and the other is avoid backward).
B) both lanes have similar lane index of 0 (because one of them is forward and the other is backward).
This means there is no penalty for zigzag since the distance is always zero. this is only important for trains who want to stop at the station though. at that point I am not sure if zigzag even matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Defect detected LANE ROUTING Feature: Lane arrows / connectors triage Awaiting issue categorisation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants