CitiesSkylinesMods / TMPE

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

Disable collision checking for vehicles stuck trying to change lanes #1518

Open originalfoo opened 2 years ago

originalfoo commented 2 years ago

image

Might be a welcome feature for some users, assuming there's some way to detect the situation (path unit inspection upon certain wait timer value?). Maybe it could set car behind to temporary DLS if there are sufficent lanes, etc?

Example of turning off collision detection if DLS not possible: https://steamcommunity.com/sharedfiles/filedetails/?id=2172948371

krzychu124 commented 2 years ago

I've not dug deep enough to see if it's possible to detect such case. The best would be to block lane change - maybe put the vehicle into "wait for better occasion" (via additional flag) or increase speed above the limit to speed up the maneuver.

originalfoo commented 2 years ago

"wait for better occasion"

If the lane the vehicle wants to move in to is jammed, it's likely because the exit ahead (which it wants to take) is also jammed so there won't be a better time to change lane?

Maybe the lane change aspect is not relevant though... I guess what is really desired is: If my car gets stuck waiting (my wait timer > x) behind a stuck car that isn't my leader car (!leader wait timer > my wait timer), can I move in to adjacent lane to under/over take it? Sort of inverse-E.V.E.

The fact that the stuck car in front isn't my leader car indicates it's not going where I'm going, so it's more likely I can benefit from routing round it. Also... not only is stuck car in front not my leader, but my car would not be a follower of anything. So we can filter out lots of potential vehicles hopefully quite fast. It means a "traffic chain" (leader/followers) stuck in a jam won't have loads of vehicles trying to DLS.

originalfoo commented 2 years ago

Rough sketch:

if (iAmNotAFollower && myWaitTimer > someVal) {
    if (mySegmentEndsAtJunction) return;
    if (iAmStuckDueToCollision && carInFrontWaitTimer > myWaitTimer && lanesGoingMyDirection > 1) {
        tryDLS();
    }
}

Vehicle.Flags.Congestion might be of use.

originalfoo commented 2 years ago

Additionally, maybe existing DLS should only kick in for vehicles where wait timer = 0, and are following a leader car, but only if they are faster than the leader car. That would also stop excessive lane changes for vehicles on highways, etc. It would give the appearance of cars overtaking slower cars in front of them.