Skip to content
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

[Epic] UI: Lights Tool #8

Open
originalfoo opened this issue Feb 1, 2019 · 39 comments
Open

[Epic] UI: Lights Tool #8

originalfoo opened this issue Feb 1, 2019 · 39 comments
Labels
enhancement Improve existing feature EPIC Collation of related issues feature A new distinct feature in-progress The problem is being solved currently Pedestiran Crossing TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc UI User interface updates

Comments

@originalfoo
Copy link
Member

originalfoo commented Feb 1, 2019

This is a redux of VictorPhilipp/Cities-Skylines-Traffic-Manager-President-Edition#143

Requires #3 and #4

When customising traffic light sequence, I think it would be much more intuitive if the visualisation was on the roads, rather than floating panels.

Each lane connection (either as customised by user or default routing, as applicable per incoming lane) would be illustrated on junction as a thin white or grey line, also showing conflict points when zoomed in (see #4).

For each incoming lane, a small circle at the junction-end of that lane depicts the traffic light state for that lane in the current step:

This approach fixes VictorPhilipp/Cities-Skylines-Traffic-Manager-President-Edition#90

Clicking the circle:

  • Left click (primary button) toggles between green/red
  • Right click (secondary button) clears any green lights for this lane within the entire sequence (ie. circle goes grey)

When an incoming lane has the green filled circle (ie. green light for current step), additional visualisation occurs:

  1. The 'lane connectors' applicable to that lane turn green (normal width)
  2. The incoming lane is given a green outline (similar to how old Traffic++ mod outlined lanes) all the way back to the previous junction node (or end of network)
  3. The outgoing lanes connected to the 'green lit' incoming lane get orange outlines all the way to the next junction node (or end of network)

Note: Visualisation for 2 and 3 above would probably need a segment count limit (eg. if the traffic lights are on a highway junction that trails all the way to the edge of the map; rare but not unheard of).

This would make it massively easier to see what's going on, because it clearly depicts the lane the traffic arrives from, the route across the junction (including conflict points if applicable - see #4), and the lanes the traffic will exit on up to and including the next junctions (hugely useful when sequencing multiple junctions). Also, the presence of any grey circles alerts me to lanes that aren't getting any 'green time' in the entire sequence.

If possible, also allow the pedestrian crossing to work in similar way - ie. circles at both sides of road, and even on median if possible (I saw discussion on Steam with user asking if it's possible to make pedestrians wait at the median before completing journey across the road). The pedestrian crossing could also indicate conflict points (eg. cims crossing a lane that's on green light = bad).

@originalfoo
Copy link
Member Author

Source repo for old T++ mod: https://github.com/joaofarias/csl-traffic

@originalfoo
Copy link
Member Author

In the UI panel that lists the steps, hovering over an existing step could quickly show the UI on the roads (eg. the green lane highlights and so on) allowing user to quickly see how the sequence works.

@krzychu124 krzychu124 added enhancement Improve existing feature feature A new distinct feature labels Feb 1, 2019
@originalfoo originalfoo changed the title Better traffic light visualisation Better traffic light editing/visualisation Feb 2, 2019
@originalfoo
Copy link
Member Author

As this new UI would be lane based, it would probably merit a keyboard modifier to allow toggling all lanes on one direction (for a given segment):

  • Click: toggle light state of clicked lane
  • Right click (secondary mouse button): clear all light changes for clicked lane (i.e. set to grey circle)
  • Shift+Click: toggle light state for all lanes on current segment that travel in direction of clicked lane
  • Shift+RightClick: like shift+click, but clears all light changes (ie. grey circles them) for affected lanes

@originalfoo originalfoo changed the title Better traffic light editing/visualisation UI: Timed traffic lights editing/visualisation Feb 7, 2019
@krzychu124 krzychu124 added this to the UI improvements milestone Feb 7, 2019
@originalfoo originalfoo changed the title UI: Timed traffic lights editing/visualisation UI: Lights Tool Feb 8, 2019
This was referenced Feb 11, 2019
@VictorPhilipp VictorPhilipp added the UI User interface updates label Mar 14, 2019
@brunoais
Copy link

brunoais commented May 5, 2019

As this new UI would be lane based, it would probably merit a keyboard modifier to allow toggling all lanes on one direction (for a given segment):

* Click: toggle light state of clicked lane

* Right click (secondary mouse button): clear all light changes for clicked lane (i.e. set to grey circle)

* Shift+Click: toggle light state for all lanes on current segment that travel in direction of clicked lane

* Shift+RightClick: like shift+click, but clears all light changes (ie. grey circles them) for affected lanes

I would add Ctrl+LeftClick to set all lights for the current road, regardless of where the cars are going.

@kvakvs
Copy link
Collaborator

kvakvs commented Aug 2, 2019

The color here is used for the traffic light. And you add another color, of the connector. Don't mix two colors, maybe give numbers or icons, or geom shapes. Assume that some people have a hard time distinguishing red and green, for them we might change red to thin line maybe. Like your first prototype it was good for color blind.

@krzychu124
Copy link
Member

krzychu124 commented Aug 2, 2019

OK, so I'll remove lane color line.
I would leave segment background as is (color can be adjusted) and I'll add something for lanes.

[EDIT_1]
Frame (1)

@kvakvs
Copy link
Collaborator

kvakvs commented Aug 3, 2019

I assume this is 3 levels of the same editor?
This will need some help and tooltips. It all makes sense after looking at it for a while, but first impression was WOAH what is this and how to use.

  • View 2 makes no sense as it shows less info than there is in view 3, how do you remove or merge 5 lanes from Segment_1 in view 3 into 3 lanes in View 2? Do you drop Tram and Ped lights? Maybe view 2 is not needed?
  • View 3 with horizontal panels one per color looks nice.
  • The background colour kind of makes sense, but some of the lane connector colours are really strong and poisonous to be used as UI background :)

Please think where the controls for editing will go in this UI, find some space for them. The controls can be in a dynamic panel which moves if you click another Segment panel and can push other panels away to make space temporarily.

@krzychu124
Copy link
Member

Lane connector colors will be changed( #287 ).
To be honest I am not sure which view is 2 and 3 for you :) It's general idea / experiment rather than mockup we should try implement. I'm trying to mix the best things from previous examples. It's not so easy and I'm not UX designer...

Back to the 'mockup', I even thought about making it bloody simple, say matrix of toggles (green/red) where column would be one step and row would be traffic light 🚦 then add buttons for grouping 🚦 by segment, node, route direction etc.

Now I've got another idea to move whole traffic lights setup to game world space 😄
For example, in the middle of intersection add canvas with basic settings (step + time), another canvas for each segment in which user will select type of traffic light (currently implemented combination - all dir, L + FR, FL + R etc..) then for each lane, draw lane wide rectangle - toggle button (green/red). Somewhere place switch for steps (or manager) and maybe render previous/current step using lane connections.

Quick ugly example
Zrzut ekranu (232)

@kvakvs
Copy link
Collaborator

kvakvs commented Aug 3, 2019

This looks like an amazing idea just as it is hard to design well and implement :)
For example of my lane arrows experiments the simplest without UI (highlights only) is so far the best.

@krzychu124
Copy link
Member

I think whole traffic light step settings and other node specific options we could place in floating window like it is now.

Possible interactions:

  • right click - change traffic light type (floating circular menu?)
  • left click - change state

I think it may be way simpler to implement than regular UI dialog, because here we need only to know segment lane width and it's direction vector to properly position rectangle.
For more groups of vehicles we can add another row of toggle buttons (green/red) + vehicle icon,

v0.02 (crazy idea) - colours are quite random ;)

Zrzut ekranu (234)

@originalfoo
Copy link
Member Author

Rather than up/down arrows, we could add small drag handles to the left of the steps and allow drag to re-order. The space where the up/down arrows are could then be replaced with an icon to access the settings for the adaptive step switching.

@krzychu124
Copy link
Member

Good idea, I thought about drag&drop too.
I forgot to add handle/button, whatever to actually select active step and toggle edit mode.

Another problem is that currently we have one traffic light per segment +additional for specific vehicle, not for each lane 😕

@originalfoo
Copy link
Member Author

I remember Victor saying that the data model is per lane, but the classes are currently per direction / traffic type. From user perspective I think the direction stuff still makes sense, although if we did it by lane we could have a keyboard modifier to "apply the change I'm about to make to all lanes on this segment going in that direction"?

@originalfoo originalfoo added the TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc label Aug 11, 2019
@dabreegster
Copy link

Hi, not sure how to best reach out to the active folks on this repo, but I've been working on a traffic simulation game from scratch called A/B Street and noticed that we're exploring some of the same UI problems. Representing and editing traffic signals is one of my favorites. :) I just uploaded a new video of what it looks like now: https://github.com/dabreegster/abstreet/blob/master/docs/videos/fix_traffic_signal.gif

If y'all ever want to collaborate or brainstorm together, let me know! Not sure if the TM:PE community is interested in bootstrapping from real cities, but I've done a fair amount of work mangling OpenStreetMap into a form usable for traffic simulations. If the map format TM:PE uses is documented somewhere, it could be fun to try that import out.

@originalfoo
Copy link
Member Author

@dabreegster

Not sure if the TM:PE community is interested in bootstrapping from real cities, but I've done a fair amount of work mangling OpenStreetMap into a form usable for traffic simulations. If the map format TM:PE uses is documented somewhere, it could be fun to try that import out.

TM:PE is a mod for Cities: Skylines game, which is built in Unity engine running in Mono environment. There have been a few integrations in the past, but I'm not sure if any are actively maintained. The following mods might be of interest:

@MacSergey
Copy link

Yesterday I set up the traffic light at a difficult intersection. It took a lot of time because always somewhere some traffic light forgot to turn on. Then I drew this intersection on paper and set it up the first time. How do you like the idea of showing lines where cars can go from each green light? And also show which traffic lights remain red all the time?

70CB16E4-2675-4BAD-91EE-0A7003B41E8C
76A5C31A-B6E5-4153-A410-3DFC71D4B0D0
8EF40C35-AAA9-4ECD-989D-3E7CEEBD8DA1
2391C655-D02D-458F-B3E5-737CF691517D
4D08BC7C-B555-4F00-8199-7CFDFDBC1FCA
1CEF6B1E-CA55-428C-B545-CC8CCC7149E4

@s2500111
Copy link

s2500111 commented Nov 7, 2020

Maybe, as an inspiration, I'll just leave the link to a video I once made here. I think, this would be really complicated, but it would also be really cool, if possible.

vlcsnap-2020-11-07-20h04m46s023

@kvakvs
Copy link
Collaborator

kvakvs commented Nov 7, 2020

Nice, just like i imagined it.
The game operates segments and lanes, so it is no problem to highlight segments where the cars can go and link them with a line in some pretty way. But it will not be as pretty like the intersection marking mod can do, though.

@s2500111
Copy link

s2500111 commented Nov 7, 2020

Maybe one could even reuse code from the IMT for the intersection part? We could ask the author if he can create some kind of API to autogenerate markings dynamically. Maybe even with transitions for this use case.

Would be great anyway, if those mods could interact and autogenerate some markings, even though this would probably be a long way to go.

@s2500111
Copy link

Anyone thought about how to convert current setups to a lane based model?

I also found that the underlying data model is lane based, but when vehicles are interacting with the traffic light, it is based on the direction the car is taking. It should be standard, to change all traffic lights of the same direction at the same time, as long as they aren't decoupled manually. It would be even better, if users could change groups of lights manually.

However, currently, there can be multiple states for one line of traffic. E.g. a lane that is straight + left and straight is green while left is red. This is unwanted, bad behavior in most cases, but makes sense for some vehicles such as trams in dedicated lanes. So while lane based is good in general, maybe it should be possible to still split this direction wise.

So features I would expect from this are:

  • lane based green or red
  • grouping of lanes
  • splitting of lanes by direction

The last one would also allow to convert any current light into the new system.

@brunoais
Copy link

I disagree. In real life, traffic lights are direction-based and not lane-based. The custom traffic lights should reflect that. Currently, it reflects that. If you think otherwise, pls explicify.

@s2500111
Copy link

I disagree. In real life, traffic lights are direction-based and not lane-based. The custom traffic lights should reflect that. Currently, it reflects that. If you think otherwise, pls explicify.

Yes and no. In real life traffic lights are direction based most of the time. But this is not completely translatable into the simulation, as complex intersections are containing multiple nodes in the game and a certain lanes direction at a node might not correspond to their direction at an intersection. Even a plain old diamond interchange runs into that trouble, as when you allow throughtraffic for both directions, left turning vehicles will also drive into the intersection (green marked areas) and start blocking the way of the left turning vehicles (red marked area) from the opposing site. In real life this is solved by differentiating the left turn lane before the DI. In the game, all forward lanes are straight lanes. Therefor, a lane based approach should be used to model this behavior from the real world in the simulation through user interaction.

Click to see image

20210131165724_1

Another issue is, that directions are arc based. So in some cases, multiple lanes can have the same direction (e.g. straight), even though they lead to different road segments and might deal with different conflicts:

Click to see images

20210131170625_1
20210131170629_1

@brunoais
Copy link

brunoais commented Jan 31, 2021

For case 1: I don't understand your problem. That one is handled by using exclusive action lanes. For example, a lane exclusively for turning left and traffic light selecting for that turn.

For case 2: That is a potential problem but it's not as bad as it seems. With just a very tiny tweak in any of the 3 roads, you can easily go around that limitation. Usually, that limitation isn't a problem at all.

@s2500111
Copy link

For case 1: I don't understand your problem. That one is handled by using exclusive action lanes. For example, a lane exclusively for turning left and traffic light selecting for that lane.

The Problem is the light before entering the DI. You can't have a left turning light like this separating turning cars from them going straight, as long as you're in a direction based approach:

Click to see image

dingsbums

For case 2: That is a potential problem but it's not as bad as it seems. With just a very tiny tweak in any of the 3 roads, you can easily go around that limitation. Usually, that limitation isn't a problem at all.

Not having a feature because you can wiggle your way around this, isn't a great argument. And yes, I often struggle with this limitation, as sometimes there are reasons for having an angle like that. Also, Intersections with more then 3 Options exist. Look in the image below and imagine the red arrows being a main direction of traffic. So you want to combine those, but still want to allow turns like the blue arrow is showing. So you give vehicles an extra lane, start setting up the light and will figure, that there is only one option for turning left. Good luck figuring that out.

Click to see image ![6waycrossing](https://user-images.githubusercontent.com/11500068/106393335-d2857b80-63f6-11eb-9f84-893c59e758ca.png)

Conclusion: Traffic directions ingame are not necessarily working in the same way as they do in real life and are therefor insufficient to model a lot of scenarios, that are modeled with them in real life. The model currently used has serious limitations for a lot of common, complex intersections, like DIs or signalized roundabouts. The best workaround that is also feasible to implement is a lane based approach. Anything else like path prediction over the next nodes is way more complicated.

@brunoais
Copy link

brunoais commented Feb 1, 2021

1: In that example, in the foreground, there's traffic lights for forward and left but the first intersection one doesn't make sense because both need to be in sync. In the background, there's another pair of traffic lights and those make sense for the situation.

2: In that image, why would you want to have different light settings between the ones turning the sharpest angle and the not-as-sharp angle right? It can be you want the sharpest right to be able to move but then you are blocking the less sharp right with that move.
Those kinds of intersections exist, however, they are a mess to manage without being 1 full way at a time instead of selective lane/destination. Do you know any such intersection in real life that hasn't become a roundabout and has selective traffic light for different destinations?

Also: Don't forget that whatever you are suggesting here will also affect users that don't use those intersections. I believe that whatever is coded, should be given very straightforward and "clean" use for the 90-99% of the cases. The rest done as viable.

I believe what you are telling are valid capable choices, however, they are not common enough to make UX that makes matters worse for the 90-99% of the cases to solve what you are bringing here.

@s2500111
Copy link

s2500111 commented Feb 1, 2021

Well, there's your problem

Last comment on this discussion from me, as this isn't leading anywhere.

@brunoais
Copy link

brunoais commented Feb 2, 2021

You have multiple problems that are not related to the problem you presented:

  1. You are allowing traffic to enter a blocked intersection while you should have set so it stays clear.
  2. You are using motorway roads to do a job of normal roads. Motorway roads don't work well for intersections with lights. Even worse when there's motorway roads but, in between, it's not a motorway road.
  3. Significant: The roads coming out of the motorway only has 2 lanes. 3 lanes would be ideal where one of them is about turning around.

Did you do the cycle as it is done in real life? If so, just doing the 1st one I mentioned will go a long way so you can reduce the light's timer. You could also use the fact you can make the timing flexible so it goes red when there's no more traffic for a set green light (not sure but I think you are not using it)

@s2500111
Copy link

s2500111 commented Feb 2, 2021

Direct answer I specifically built the intersection to prove my damn point. I'm not only well aware about the flaws, some of the flaws you mention aren't even flaws. E.g. there's no difference between highways and normal roads, when you modify them enough, eg. lowering the speed limit and allowing cars on normal roads to enter blocked junctions. Motorways have no limitations regarding traffic lights beyond some of them missing the traffic light prop. The code isn't asking if a car is on a motorway and then ignores that there is a light.

But all your comments are beating around the bush. The video shows one intersection, but this one intersection contains two nodes. So the left turns are obscured by the games mechanics. This is an issue for all intersections with multiple nodes.

Not being able to separate traffic flows by lane and not by an arbitrary defined angle is a real limitation. Your argument of mur realism because this is the same as in the real world, is not useful, as in real live, there are more then 3 directions (e.g. slightly left instead of left) and the multiple node problem is not existent, as reality isn't using a model of the reality.

But to bring this to a meaningful conclusion there are some demands a new model needs to fulfil:

  1. Compatibility with the current system. This means, a lane of traffic can have multiple states at once. This is mostly not a thing in the real world for cars, but often seen for transit signals, so it also makes sense to implement this.
  2. The combination of lights to groups and an intuitive pre-grouping of the lights based on their direction to mimic the old behavior when it is wanted.
  3. The enhancement of separating lanes even when they are leading to the same segment / in the same direction to allow for more flexibility in the contexts of complex intersections such as DIs or signalized roundabouts.
  4. An UI that is intuitively combining these systems.

@gam3rboy7
Copy link

Is this thread still alive?

@krzychu124
Copy link
Member

All threads are alive, just the progress depends on the amount of our free time, interests in the topic and complexity. This task is complex and requires a lot more adjustments before start we start working on it. Currently it holds ideas so we know what users expects from traffic lights tool - things/features we should consider writing new code, improving or refactoring the existing code.
As you might notice we expect new DLC to be released in the near future so all traffic lights related topics are frozen currently since I would have to write the code basically twice because of possible changes to the mod to be compatible with the upcoming content/new logic (hopefully they won't turn current logic upside down).

If you have any suggestions/idea to the topic go ahead and describe. I didn't finalize yet how it will work in details.

@krzychu124 krzychu124 added the in-progress The problem is being solved currently label Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing feature EPIC Collation of related issues feature A new distinct feature in-progress The problem is being solved currently Pedestiran Crossing TRAFFIC LIGHTS Feature: Traffic lights - toggle, timed, etc UI User interface updates
Projects
None yet
Development

No branches or pull requests

10 participants