Closed kianzarrin closed 4 years ago
State machine and example implementation of new Lane Arrows you can find here #391 . SM is just 1 module to drop into your TM:PE project. The FSM (finite state machine) module is here https://github.com/kvakvs/Cities-Skylines-Traffic-Manager-President-Edition/blob/canvas-gui/TLM/TLM/Util/GenericFsm.cs The usage is here https://github.com/kvakvs/Cities-Skylines-Traffic-Manager-President-Edition/blob/canvas-gui/TLM/TLM/UI/SubTools/LaneArrows/LaneArrowTool.cs
State machine and example implementation of new Lane Arrows you can find here #391 .
Wow! That's so cool. In any case my FSM is mutually exclusive and is for the quick-edit feature.
A more preference is given to the left and less preference is given to the right.
Using terms "left" and "right" will cause confusion due to different sides traffic can drive on (LHT/RHT, or RHD/LHD). Elsewhere we came up with following driving-side agnostic terms:
When applying state machine it might be useful to think in those terms, rather than driving side specific "left/right".
For example: On a map where vehicles drive on the left, the nearside lane would be the left lane. The most common turning lane will likely be the nearside lane. In UK that would be left lane, in US it would be right lane.
from #671 :
From steam user adam.ruscoe:
Not seen this noted as an "issue" on the thread as yet... I love the ctrl click set everything to one lane per action, but on a two lane each way section, with driving set to the right hand side the mod currently sets the right hand lane as turn right, with the left hand lane being turn left and straight on. Given than on a RHD road where you have priority you may have to wait to turn left, but don't wait to turn right or go straight on this seems incongruous with how it is mostly laid out in real life (and how I always lay out my cities in game) Admittedly I've literally just downloaded it and come across this so there may be a setting somewhere I've missed, but as a default I can see that causing more issues than less.
Issue reported for STABLE v11.0 I've asked for screenshots and any other infos to be posted here.
Its hard to know what to do when you have only two lanes but three directions! We really need a state machine.
Generally with 2 lanes and 3 directions I'd have the turning lane go the way of the near-side turn.
Maybe an Alt
key modifier that tells the applicator to use far-side lane instead?
@aubergine10 so you didn't like the state-machine approach?
PS: now I remember why I made that decision! its particularly good for timed traffic lights to have extra right turn cycle.
I think a state machine is required, it will help keep code sensible.
The question is in the lane arrow tool how the step machine should work? approach 1: state 1: TTL recommended (2 lanes: naer-side priority | 3+ lane:s Far-side priority) state 2: alternate TTL *(2 lanes far-side priority | 3+ lanes forward-priority) Ignore this if number of lanes is multiple of 3 on all node segments. step 3: clear all values to default (or undo #568)
approach 2: state 1: 2+ lanes => far side prioirty state 2: 2 lanes => near side priority | priority 3+ lanes =>forward priority. Ignore this if number of lanes is multiple of 3 on all node segments. step 3: clear all values to default (or undo #568)
Approach 1 is more consistent if you have TTL while approach 2 is more consistent if you don't have TTL.
which one should I go for?
Can we let user cycle through options?
For exmaple, if user gets far side turning lane, but they wanted nearside, they just repeat the applicator to get it's alternate result?
Similar to how Shift+S on lane connectors will cycle a segment node through a) all lanes ahead only, b) one side ahead only, c) other side ahead only
So an applicator starts with what it thinks is best, but if there are alternatives user can just repeat it to cycle them. Or add an Alt
modifier to the applicator to alter it's decision making.
Also, regarding the recent report linked above (#671) I don't think user was using TTL on that junction they were testing with.
I'm the user who was quoted in #671 and I wasn't trying to create a TTL, it just seemed odd that the lane which had to turn against traffic was also being used the be a straight on lane.
kianzarrin commented 7 days ago When you are trying to open interlocking traffic jams its best to get as many cars out of the way as possible. turning right is easy so let's get rid of those cars first.
I may not have played as much as some others, but on a RHD road where priority is set it tends to be nearside turning, straight on, offside turning in that order and by having OST and straight ahead in the same lane you're restricting the two slowest to sit until oncoming traffic clears Unless the NST road is blocked you're clearing two directions by having NST and straight ahead, but that's just my preference. As others have said, having it toggle is a good idea (or allow a preference setting in options) Other than that your mod is the best in the game by far... Do agree we could do with a lot more capability in the rail sector, but then the game isn't geared up for that it seems
OST = off side turn? = far-side turn?
Yes. If you drive on the right then turning across the traffic, ie left From what I've seen in game you're much more likely to have issues crossing oncoming traffic than anything else
When traffic is driving on the right, left turns are conflicting and should be separated over right turns (which conflicts only with pedestrians).
Would be even greater if you have both options, but separating left turns (or right turns for traffic driving on the left) is the reasonable first thing to do in 90% of all cases.
Red crosses in these pieces of paint art mark the conflict points, green arrows are free flowing directions, red arrows mark the direction which have to yield due to conflicts. Yellow arrow indicates possible obstructions, which you usually want to avoid.
When dealing with interlocking gridlocks we want to get as many cars out of the gridlock as possible. Cars taking the short turn are easiest ones to pump out. Mixing it with going straight causes problems. Also if there is a timed traffic light right turn usually takes 2 steps so it should be separate.
In the real world I see slip lanes on the right. Well this game does not have slip-lanes but allocating dedicated right turn is the next best thing.
If the roads are not jammed and the objective is to reduce delay on a fast floating road, then your approach is the better one. then again in such situation not separating lanes at all might be the best approach.
Right turn takes two steps? May you elaborate on that?
Afaik there are two problems with right turns in the game:
You also can add slip lanes, but they take a lot of time to set up, but work really well if you're doing it right.
Real gridlocks are often a problem caused by bad planning in the first place and mostly not solveable by any standard-lane-arrow config, so that should not be a concern at that point. In my experience, separated left turns are way more helpful then separating right turns, since - as stated before - combined straight and left turns result in chaos.
I looked on some intersections in my city. I found not a single one with combined left turn and straight, but separated right turns. Most intersections also had no slip lanes.
You may notice, that pedestrian crossings are set a few meters back into the road, allowing for 1 to 3 right turning cars to clear the path for vehicles going straight. This is lacking in the game and may cause some problems that are not occurring in real life. On the other hand, the problems aren't that big, as I use the same design as in those screenshots in my game cities, which have always between 70 and 80% traffic flow.
The current design also doesn't go well with any traffic light pattern, since it isn't allowing protected left turns. Which leafs us with the 2 phase vanilla-options, were left turning traffic is obstructing vehicles going straight, leading to a lower capacity, or a 4 phase design, where every direction gets a phase. In this case - and only in this case - this setup makes sense, since right turning traffic is obstructed by pedestrians, while left turning and straight are not. But it's also not very efficient to do that at all and I've never seen it IRL ...
When dealing with interlocking gridlocks we want to get as many cars out of the gridlock as possible. Cars taking the short turn are easiest ones to pump out. Mixing it with going straight causes problems.
OK, I'll answer this to the best of my knowledge... Blockage by pedestrians is true of all directions so that should be set aside
Turning right : traffic can be obstructed only if the road to the right is gridlocked - 1 obstruction Straight on : traffic can be obstructed only if the straight on road is gridlocked - 1 obstruction Turning left : traffic can be obstructed if the road to the left is gridlocked, if the road coming in the opposite direction is gridlocked or if the road in the opposite direction is busy and flowing - 3 obstructions
Consider the SECOND car in a queue... In a ┤┌ setup you have 1 obstruct to turn right but 4 to go straight on if the car in front is turning left in a ┐├ setup the left hand lane has three possible obstructs but the right has a maximum of two
I agree with S250111 in that i don't have any junctions setup with straight on and "opposing turn" in the same lane
@aruscoe when cars wait too long they give up and go through the junction and block it. so going stright
During timed traffic right right turn gets 2 cycles. So getting rid of these cars is easiest. Turning right is faster in general.
Straight on : traffic can be obstructed only if the straight on road is gridlocked - 1 obstruction
Cars turning left from opposite direction can block you. in CS they don't really follow the rules all too much!
I don't really care that much if it is the first cycle of state machine or second. @aubergine10 can we put this to vote?
@kianzarrin
During timed traffic right right turn gets 2 cycles.
I don't use timed traffic lights in my cities as they never seem to work as expected, so I am talking about traffic flow on a non-lighted junction
Cars turning left from opposite direction can block you.
My original question stated that the road you're on has priority. Haven't seen cars passing stop or wait signs although on a non prioritized route you are correct, though in that case I would generally be setting the lanes so that conflicts are avoided (not expecting the mod to do this for me)
Ok, so now you're more clear, we're talking about timed traffic lights as the reason for this. In this case, cars turning right can go, if cars going straight are moving, or cars in the crossing road turn left. Which doesn't work, if they also go straight, because then right turning cars don't get two conflict free cycles. This only works, if you're able to separate the straight from the left turning lane. Also for this to be important, there needs to be a significant amount of cars turning right, which is pretty specific.
The standard case for main roads should always be the assumption, that the majority of cars are going straight on and only a few turn right or left onto minor roads. So getting people straight over a junction should be the main concern, since most cars should do that. In every other case, user input is required. At least for now, I can think of algorithmic approaches to solve this. For getting as many people straight over a junction as possible, it is necessary to remove as many conflicts as possible. Right turns aren't a conflict with going straight, left turns are. The solution is relatively easy: long (straight + right) phase, short protected left turn phase.
This feature shouldn't solve complex junctions, but rather make it easier to work with all the small intersections where the amount of traffic should not make manual optimization necessary. It should be using common best practice for traffic planning and not some specific case, which probably isn't applicable in the places where this feature is most useful.
@aruscoe I don't use timed traffic lights in my cities as they never seem to work as expected, so I am talking about traffic flow on a non-lighted junction
maybe you should try out the quick setup feature for timed traffic lights. It works!
@s2500111 Timed traffic lights quick-setup automatically fixes the lane arrows anyway so its unaffected by state machine.
It depends on the context. If I want to use it for cities that I build I would rather a dedicated left turn. if I want to fix other peoples gridlocked cities Id rather a dedicated right turn. But to be honest if there is that much traffic I am going to use 6 lane roads anyways!
So far all customers have complained about the current state of matters and customer is always right! but the problem is Customers who are happy with the current situation are not going to complain. I am worried once I make the changes there is going to be new people here advocating otherwise.
@aubergine10 You are good at customer relation. what do you think?
I don't really care that much if it is the first cycle of state machine or second. @aubergine10 can we put this to vote?
Quick scan of google maps to check most common turning lanes for junctions without traffic lights:
By no means exhaustive, but it looks like far-side turns are most common dedicated turn lanes in that selection of cities.
I've not yet checked what situation is when there's traffic lights. I think with traffic lights there is an additional situation to factor, and that is whether "turn on red" is allowed. If so, a dedicated near-side turning lane would make it much easier for that traffic to flow when lights are red.
Also depends on number of lanes available? So states could be something like:
It might be that we end up with some new mod options, such as:
-[ ] Prefer near-side turning lanes at junctions -[ ] Prefer near-side turning lanes at traffic lights which allow turn on red
It might be that we end up with some new mod options, such as:
-[ ] Prefer near-side turning lanes at junctions -[ ] Prefer near-side turning lanes at traffic lights which allow turn on red
Seems like a good solution to me.
There's some stuff here that might be relevant: https://github.com/CitiesSkylinesMods/TMPE/issues/63#issuecomment-462480725
Generally the far-side turn is unprotected (unless there's traffic lights or something to control flow of traffic); vehicles making unprotected turn will have to yield, creating a queue, so dedicated turning lanes are used to split that queue out of the main traffic.
I think my allocation of dedicated turning lanes is my post popular work so far! simple and effective. Its time to prioritize improving this.I guess it will take me half a day to (RHT):
laneCount %3 !=0
Is that faster than laneCount > 3
?
These two predicates have entirely different meaning.
lanecount %3 != 0
means that it will be true for 1 2 4 5 7 8 10 11+
lanecount > 3
will be true for 4 5 6 7 8 9 10 11 12+
I think we shouldn't extend the scope on roads wider then 3 or 4 lanes, since in these cases it really starts to depend on the environment and where routes go. In this case, >2 is better, since it handles all roads with enough lanes in the same manner.
Even though a completely automatic optimization of the lane arrows and traffic lights / priorities depending on the traffic volumes would be awesome.
I already support roads 4+ lanes. The remainder goes to far turn. now with the state machine the remainder goes to straight lane.
I created issue #752 about what should happen on bus lanes. for the time being it will alternate in the state machine: mixed/separate calculations
In #537 I implemented lane arrow separator to allocate dedicated turning lanes. The lane distribution is according the the number of turning lanes in each of the directions⬅️ ⬆️ ➡️. A more preference is given to the left and less preference is given to the right.
Now when segment has two lanes you automatically separate lanes to(right hand traffic): ⬅️ + ⬆️ || ➡️. This is good for quick-setup of timed traffic lights. I think it would be nice to be able to switch to ⬅️ || ⬆️ + ➡️ after another alt+click on (https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/pull/538#issuecomment-552149363 ). This would be good for a different setup kind of timed traffic light .
because of a bug the LHD is the opposite way around (https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/pull/564#issuecomment-557771623 ).
The state machine can also dictate how the lanes are distributed. should we give preference to left in one state and preference to forward in another state? should this be in options menu? or should we keep things simple?