CitiesSkylinesMods / TMPE

Cities: Skylines Traffic Manager: President Edition
https://steamcommunity.com/sharedfiles/filedetails/?id=1637663252
MIT License
569 stars 85 forks source link

Improvements to far turn on red #1585

Open Elesbaan70 opened 2 years ago

Elesbaan70 commented 2 years ago

Current Behavior

Far turn on red currently only applies to a very narrow use case in which traffic is turning from a one-way road to another one-way road:

image

This is enforced here, regardless of how the junction restrictions are configured: https://github.com/CitiesSkylinesMods/TMPE/blob/2a4c1040cec7c06aa7bbc97e800361630e4fbb56/TLM/TLM/Manager/Impl/TurnOnRedManager.cs#L210-L243

Proposed Enhancement (MVP1)

The most basic use case that could be supported is turning from a two-way road onto a one-way road:

image

This can be supported by a simple enhancement to the logic referenced above.

In addition, the default and configurable junction restrictions should be updated to reflect actual traffic AI behavior. I recommend:

Incoming Segment Outgoing Segment Configurable Default
Two-Way Two-Way false false
Two-Way One-Way true* false
One-Way Two-Way false false
One-Way One-Way true true

*Assumes that we make the change described above

Advanced Use Cases (MVP2)

Some traffic lights allow a far turn on red on any intersection when oncoming traffic has a green light and the far-turning driver has a clear view of the oncoming lanes. The driver is informed that this type of turn is allowed by the presence of a flashing yellow arrow below the solid red light.

image

These use cases would require the following enhancements:

  1. When the far turn is into a two-way segment, TurnOnRedManager looks for an incoming segment in the forward direction. If one (and only one) is found, it records this information and allows the turn.
  2. VehicleBehaviorManager checks whether TurnOnRedManager has reported an incoming segment to test. If so, then the traffic light states are examined to ensure that it is the only one with green forward or far-turn lights. Only then is the far turn on red allowed.
  3. Default and configurable junction restrictions would be revised as follows:

    Incoming Segment Outgoing Segment Configurable Default
    Two-Way Two-Way true false

A distinction between this and the first enhancement needs to be made. Possible way of achieving this include a new junction restriction, or a new Options setting.

Elesbaan70 commented 2 years ago

Although MVP1 is quite easy, it might be best to just drop that one from consideration, so the feature doesn't get too confusing. It's actually very rare. Hardly any states allow it at all, and even then I think only at specific intersections. But MVP2, the flashing yellow arrow, is everywhere.

krzychu124 commented 2 years ago

Ok.. so it requires improvements to priority detection at intersection with traffic lights anyways 🤔

Elesbaan70 commented 2 years ago

Does that fall under that side project I've seen videos of?

krzychu124 commented 2 years ago

Hmm, no it will be added here, just need to solve few issues first (not to mention finding free time for that...)