slyh / Cities2-TrafficLightsEnhancement

Advanced traffic lights for Cities: Skylines II
206 stars 20 forks source link

Straight-Ahead Lanes Prefer the Right-Most Lane on the Opposite Side of Intersections (In Certain Cases) #66

Closed Stripedog closed 8 months ago

Stripedog commented 8 months ago

Describe the bug Straight ahead lanes prefer the right-most lane (in certain cases), resulting in unexpected and sub-optimal traffic behavior.

To Reproduce To best demonstrate this, create a four-way intersection with six-lane (3/3) roads. (I am assuming right-hand traffic.):

  1. Make the right-most lane of each road a dedicated right-turn lane.
  2. Make the middle lane a dedicated straight-ahead lane.
  3. Make the left-most lane a straight-ahead or left-turn lane.
  4. Set Traffic Signal to Protected Left-Turns.
  5. Turn on Always Green Right-Turns.

In theory, this should produce a fairly friction-less intersection. Assuming roads North, South, East, and West, the traffic should flow like this:

  1. North and South Left-Turns take place. This traffic never intersects and so can happen simultaneously at full speed.
  2. North and South Straight Ahead traffic takes place. This traffic never intersects and so can happen simultaneously at full speed. (Because the left-most lane is a left-turn and straight ahead lane, some residual left-turn traffic could take place which could potentially disrupt straight-ahead traffic from the opposite side, but the issue I'm encountering doesn't occur when the left-most lane does not allow straight-ahead traffic.)
  3. The same two steps then repeat but for East and West traffic. The same concepts as before apply.
  4. At all times, traffic in the dedicated right-turn lanes should be able to flow freely without disrupting or being disrupted by the rest of the traffic. HOWEVER: Because the center dedicated Straight-Ahead lane chooses to travel into the right-most lane on the opposite side of the intersection, slowdowns can and will occur.

Expected behaviour This slowdown can (and should) be avoided by simply having the center straight-ahead lane remain in the center lane as it travels through the intersection. Likewise, the left-most lane (the Left-Turn or Straight Ahead lane) should travel to the opposite and perpendicular left-most lanes, rather than traveling to the center lane with straight-ahead traffic.

If Always Green Right-Turns was disabled, this behavior would not be problematic. Ideally, the lanes should vary their preferred destination lane on the opposite side of an intersection based on whether or not Always Green Right-Turns is active or not.

Screenshots Example of the problematic intersection: image

Note that this issue doesn't occur if each lane allows only one movement: image

slyh commented 8 months ago

I will align the lanes to the centre when they don't fit in the middle, so the alignment shown in your first picture will be adjusted while the alignment shown in your second picture will be preserved.

As for the presets we have, I think we have no reason to align the lanes to the outer edge.

Ultimately, a free-drawing lane tool would be the solution to all the issues and limitations we're facing. However, that will have to wait until other features are completed.

slyh commented 8 months ago

It turns out I forgot this alignment case in RHT. It should be fixed in v0.2.11-alpha.