CitiesSkylinesMods / TMPE

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

shortcut to fix traffic rules where minor road joins a main avenue #541

Closed kianzarrin closed 4 years ago

kianzarrin commented 4 years ago

in real life and also in simcity when a small road joins a main avenue, the separation barrier in the middle remains unbroken and people can only turn right (the only advantage of simcity over cities skylines!!!). we already have an asset that visually conserves the junction barrier in such situations

previewfile_1319965985

But TMPE is required to make it function as it should. It can be a bit tedious to apply all the traffic rules particularly when fixing cities where many minor roads are joining one avenue.

so i suggest a shortcut: choose junction priority tool then press ctrl+click on a junction to set all rules regarding the above scenario:

Let me clarify I prefer this feature apply to all big roads such as this: median rules

krzychu124 commented 4 years ago

Ok, that will be the hardest of all you've posted. We still don't have algorithm which would properly detect road medians, also I am not sure how do you want properly distinguish road types (I know that we have 'levels' but still, not trivial task.

kianzarrin commented 4 years ago

I think the same concept can work on a scenario like this. Except that highway ramps do not need to give way. highway fork

kianzarrin commented 4 years ago

@krzychu124 We don't need algorithm to detect road median. if the user uses ctrl-click, then we assume that there is. Also the smaller road is going to be the one which gives way. if there are three segments the smalls segment gives way.

kianzarrin commented 4 years ago

@krzychu124 even if there is no junction median it still does not mean people wouldn't want to ban left turn.

krzychu124 commented 4 years ago

I've had to read again description to got the point. Please format it using markdown I assume you will apply 'no left turn' to all lanes of clicked segment, what if user click at segment which he shouldn't? Will it aplly rules to any segment you click or you are going add filter with requirements(number of lanes, segment type etc.) when applying rules.

kianzarrin commented 4 years ago

@krzychu124

I've had to read again description to got the point. Please format it using markdown

sorry for bad description. I hope its a bit better now.

I assume you will apply 'no left turn' to all lanes of clicked segment,

CTRL-click on a NODE to be more accurate.

what if user click at segment which he shouldn't?

Accidental CTRL+click will make accidental changes. I can ask the same question in the junction priority tool what if the user accidentally presses Shift+Click on a long road and messes up his whole road?

Will it apply rules to any segment you click or you are going add filter with requirements

as for requirements and special case situations we need to decide the following:

We still don't have algorithm which would properly detect road medians, also I am not sure how do you want properly distinguish road types

the Vanila 6 lane boulevard does not have junction median but I still want to be able to ban left turns. median rules

I think checking for junction median is possible though a bad Idea. I can check if there is a central lane with no vehicles on it. or I can check for the 'Can cross lanes' property.

kianzarrin commented 4 years ago

7 and #539 are related.

kianzarrin commented 4 years ago

I wrote the code that works in basic circumstances. https://github.com/kianzarrin/TMPE-kian/tree/PriorityRoad

My UI is a bit more whack than #77 so that might need some fixing. Also I noticed that the Overlay update functionality is also whack. It does not refresh view soon enough. I have to close and open TMPE tool to see the changes. That also needs some fixing.

My current code can handle some simple and moderately complicated cases: Screenshot (6) Screenshot (7) Screenshot (8)

but it fails when it is very complex. I will work on that. Screenshot (9)

The junction to the right does not ban turning into the small road because it is straight. I don't think I can do anything to fix that unless if I use lane connector tool which I think is too complicated for the scope and objective of this issue. also the small road should not have a right turn arrow but rather a forward arrow. That also introduces a problem that I cannot fix without the use of lane connector and that problem is if there is another minor road on the other side of the road, cars can go to it crossing the main road.

The problems of the junction to the left are obvious. I am wondering should I even handle such a case where the main avenue has a right angle?

kianzarrin commented 4 years ago

@krzychu124 @aubergine10 Give me some ideas. any more complicated cases you can think of.

I can think of this one and I am not sure what should happen. Screenshot (10)

kianzarrin commented 4 years ago

I always can exclude cases where it gets too complicated or nonsensical. I already have decided to exclude one way main road (that is if any of the biggest roads are one way, I return without doing anything).

kianzarrin commented 4 years ago

I did some more thinking and changed my opinion:

originalfoo commented 4 years ago

remove zebra crossings on the avenue

Would be cool if we could hide the crossing decal/prop too, although not sure if it's possible.

We don't need algorithm to detect road median. if the user uses ctrl-click, then we assume that there is.

I agree with this in principle, essentially we're offloading "median detection" work to the end-user.

However, on a long road with lots of junctions, it could quickly become tedious to click each junction in turn. That being said, auto-median detection is something that could be investigated as separate task at some point in the future.

originalfoo commented 4 years ago

What if instead of doing it based on user click, we just make vanilla 'Priority Routes' more intelligent?

Currently, with vanilla functionality, if you set a route to be priority route the result is that side roads get "Stop" signs on them, which is often very annoying and bad for traffic flow.

TM:PE could do something much better; just as we have "highway rules" stuff in mod options, we could have "priority route rules" stuff that gets applied to any priority route? We could treat a priority route as if a user has Ctrl+Clicked all the junctions along it, but allow user to override any setting at any junction as usual.

If road names are displayed (vanilla game setting), user can quickly get to the relevant info view by clicking the road name. From that info view they can draw the routes, and any they mark as "Priority road" (or whatever the vanilla option is called) will get updated with enhanced TM:PE goodness.

kianzarrin commented 4 years ago

~~I have added the following options to make this more like the options of the roundabout mod: change lanes minor road change lanes major road enter blocked minor road enter blocked major road yield minor road~~

brainiac This should help a bit with your request too: Screenshot (55)

In any case its a cool Idea to be able to select multiple segments and change all options together for the junction restriction tool. or otherwise be able to ctrl-click on a junction select all connected segments to perform mass edits.

kianzarrin commented 4 years ago

I am trying to decide which options to include:

* I want to add
< I want to remove
*< does not exist and I don't think I should add
//rabout_DecicatedExitLanes
//rabout_SwitchLanesYeildR<
//rabout_SwitchLanesMainR*<
//rabout_StayInLaneMainR
//rabout_StayInLaneNearRabout
//rabout_NoCrossMainR
//rabout_NoCrossYeildR<
//rabout_PrioritySigns*

//avn_NoCrossMainR
//avn_NoCrossYield*<
//avn_NoLeftTurns*<
//avn_EnterBlockedMain*<
//avn_EnterBlockedYeild*
//avn_StopEntry*
//avn_PrioritySigns*
//avn_SwitchLanesMain*<
//avn_SwtichLanesYeild*<

There is a trade off between usability and complexity.

This is a bit in contradiction to what I said here in the comment above. This also concerns #539 And here are the options in roundabout builder for comparison: Screenshot (67)

EDIT: I wonder if a state machine could be utilized in a meaningful and useful way.

kianzarrin commented 4 years ago

Progress report: code: https://github.com/kianzarrin/Cities-Skylines-Traffic-Manager-President-Edition/tree/PriorityRoad test city : https://steamcommunity.com/sharedfiles/filedetails/?id=1917803358 do not forget to go to mass edit options and turn on everything :) Please shift click on different road segments and see what happens.

I handle all these cases: Roundabouts

Priority road:

Screenshot (74) ScreenshotA Screenshot (74) - Copy Untitled

EDIT: Note: the difference between a roundabout and priority road is sometimes a gray area. The half roundabout code for example is handled by my priority road class.

PS: As much as I am proud of this in future maybe it is best to have all these rules by default. that is TMPE would use such road rules by default so that the user does not even need to mass edit. Although I am not sure if it is even possible.

originalfoo commented 4 years ago

PS: As much as I am proud of this in future maybe it is best to have all these rules by default. that is TMPE would use such road rules by default so that the user does not even need to mass edit. Although I am not sure if it is even possible.

This could be very confusing for a lot of users. For example, we get regular issues where people have set up crazy customisations and then wonder why their traffic is broken. So I think it best to avoid automatically applying customisations; if user has to manually apply (including manual bulk application) and something goes wrong, at least they have some idea of what they did to make it go wrong.

Also note that there is a 16 MB limit (link to old repo) to the amount of data TM:PE can store in save games, and automatically applying customisations could potentially push over that limit on large cities; and even if not, might cause general performance issues.

Sipke82 commented 4 years ago

If it's possible i would also vote for changing the default..

kianzarrin commented 4 years ago

maybe we should put this pictures in the wiki some time: Screenshot (979) Screenshot (984) Screenshot (983) Screenshot (982) Screenshot (981) Screenshot (980)