CitiesSkylinesMods / TMPE

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

Traffic honoring separated lanes #192

Closed VictorPhilipp closed 5 years ago

VictorPhilipp commented 5 years ago

Hi, this is Lazarus Man, author of NExt2. As the title implies, I would like to add an enhancement (possibly as an option) to allow pathfinding to recognize split lanes. The game kinda already does this if the NetInfo.m_CanCrossLanes = true. This prevents cars from crossing oncoming traffic on roads with medians such as the vanilla medium road. However, I wanted to take this a step further and prevent traffic from switching into any lanes that are separated by a barrier.

Currently I am working on https://streetmix.net/-/723477. There are 4 lanes in the middle of the road with a detached parking lane on each side. This enhancement would only allow the detached park lane to be accessed at junctions. Since these parking lanes are a bit slower than the center four lanes, cars would only enter this lane to park, bus stop, or make a right turn at the next intersection. I have already developed a POC where cars cannot jump the barrier (except emergency vehicles) and LaneConnections cannot be made over the barrier. Roads with center barriers also will prevent users from making U-turn LaneConnections, UNLESS NetInfo.m_CanCrossLanes = false. While I watched this road mechanic under heavy traffic I realized that it would be very useful for situations where plenty of hand drawn LaneConnections would be needed to separate heavy local and express traffic. I am also experimenting with a similar concept for MOM stations.

There are obviously a lot of variables to consider. The biggest one would be your interest in the idea. It's main goal is to open up a new road mechanic and since this mod basically completely overhauls pathfinding, it would make more sense to add this enhancement to your mod rather than build something new which would reuse a lot of the existing mechanics.

https://github.com/VictorPhilipp/Cities-Skylines-Traffic-Manager-President-Edition/issues/196

VictorPhilipp commented 5 years ago

Have you developed your POC by extending TM:PE or how have you achieved it?

A feasible approach to automatically detect forbidden lane changes might be to check if the lane adjacent to a vehicle lane has m_laneType=None or m_laneType=Pedestrian. What do you think? I guess it would not be hard to implement this.

VictorPhilipp commented 5 years ago

I finished it weeks ago but got lost in github lol. I don't want to screw with your work and so I decided to continue with testing instead. I was wondering if you could provide me a branch to commit to or if you had an idea of how to commit it in such a way you could take a look. Unfortunately, it would be hard to test without roads that needed the functionality but I am currently building such roads.. Basically it is two part. It checks both in the laneconnectortool and routingmanager. In so many words, lanes are grouped by their continuity. If two lanes have a gap between them (their edges aren't contiguous or overlapping) then they are separated into groups and both the laneconnectortool and the routingmanager will bypass that connection.

Edit: I may use the way you suggested and check if there is a non car lane between the two car lanes to decide groups.

VictorPhilipp commented 5 years ago

Sorry I know this has been a while. I got diverted with getting an update out for MOM mod. I will probably just release the road first so everyone can get their hands on it and I can get this really annoying 'New Roads for Network Extensions' issue put to bed. Then I will continue getting this together. Alternatively, I suppose I could just create a new branch and put the POC in there but after your inputs it gave me pause to reconsider my approach.

VictorPhilipp commented 5 years ago

@andreharv we're investigating issues relating to medians, etc., in new fork of the mod - if you get time, could you let us know your thoughts here: https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/issues/89

originalfoo commented 5 years ago

Going to close this as duplicate as the issues are summarised in #89

Elesbaan70 commented 2 years ago

1528 will address this issue