-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
State machine for separate turning lanes. #567
Comments
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. |
Wow! That's so cool. In any case my FSM is mutually exclusive and is for the quick-edit feature. |
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 :
|
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 |
@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 2: 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 |
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.
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 |
OST = off side turn? = far-side turn? |
Yes. If you drive on the right then turning across the traffic, ie left |
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 ... |
OK, I'll answer this to the best of my knowledge... Turning right : traffic can be obstructed only if the road to the right is gridlocked - 1 obstruction Consider the SECOND car in a queue... 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.
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? |
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
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. 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. 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. |
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? |
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 |
Seems like a good solution to me. |
There's some stuff here that might be relevant: #63 (comment) 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):
|
Is that faster than |
These two predicates have entirely different meaning. |
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 |
fixes #567 dedicated turning lanes now has a state-machine of 2-states: - 2 lanes: dedicated far turn | dedicated near turn - 3+ lanes: favor left then forward | favor forward then left - car+bus lanes: mix bus and car lanes | calculate bus arrows and car arrows separately Notes: - I moved code to dedicated UTIL class. - I polished the code to use the same code path for near and far turns reducing code complexity.
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 (#538 (comment) ). This would be good for a different setup kind of timed traffic light .
because of a bug the LHD is the opposite way around (#564 (comment) ).
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?
The text was updated successfully, but these errors were encountered: