CitiesSkylinesMods / TMPE

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

[EPIC] UI: Routing Tool #41

Open originalfoo opened 5 years ago

originalfoo commented 5 years ago

This tool visually combines the features of the Lane Arrows and Lane Connectors tools.

Lane Arrows

Current implementation is floating panels with buttons for each direction. I find this a bit confusing to use, and clunky to work with. Maybe using arrow glyphs (rather than characters) on the buttons would be better, where only one button (and thus glyph) can be active at a time?

Also, it would be nice if we could add a few new arrows?

Issue: Most roads don't have deflect, merge or diverge arrows. Some roads do, but only via supplemental lane marking asset packs. We'd need some way for user to choose which decals to use to represent the new arrows, possibly via integration with Find It! mod.

Two other things:

The full list of arrows:

They could be arranged in a grid, something like:

IL LF F FR IR
ML L LFR R MR
H  DL LR DR  X

With the exception of H (hide) and X (reset), all the arrows equate to lane connections. Depending on what's attached to the nearby node, some arrows would be unavailable. For example, at road junction, the diverge, deflect and merge arrows would not be applicable. Diverge and merge are only available when a road widens or narrows, respectively. Deflect only applicable on normal nodes where both segments are same number of lanes. Left turn only applicable if there is a left turn, and so on...

As inferred from the above, it's not just at junctions where the lane arrow tool is applicable; it's also useful at nodes where different types, or even same type, of road meet.

When hovering over an arrow button in the panel, the following happens:

This way the user has zero doubt as to what effect the arrow will have if they choose it.

If any of that sounds feasible, let me know and I'll do a quick graphic mockup of the grid layout.

originalfoo commented 5 years ago

Lane Connectors

These could do with some visual enhancements.

First, better arcs that represent the actual path vehicles will take. See #3, and subsequently #4.

Second, using circles for both incoming and outgoing lanes is a bit confusing.

This would make docs easier: Click a square to select the incoming lane, then click one or more triangles to select outgoing lanes.

Visually, the user is drawing arrows (line with a triangle at the end) from a square (incoming lane), thus depicting the flow of traffic through the junction.

Colours:

When user customises lane arrows, they are effectively making custom lane connectors for those lanes.

When hovering over a lane arrow (in floating panel), or a square or triangle (on the road), it's lane connectors should be normal width and the other lane connectors should shrink to thinner width. This will make it clear which lane connectors the user is currently interacting with.

originalfoo commented 5 years ago

Eraser tool

As per #38, there will be an eraser tool on the toolbar.

While the Lane tool is active, the user can click the eraser, then:

originalfoo commented 5 years ago

Stay on lane feature

I had no idea that this feature, Shift+S, existed until now.

Would be nice if there was some UI (either in floating panel or some shape on a road?) to allow 'stay on lane' to be a) discoverable and b) can be applied via mouse.

Should this feature be disabled at junctions? It's main use seems to be normal nodes, and especially 'bend nodes'. EDIT: Yes, as per current TMPE implementation.

originalfoo commented 5 years ago

TMPE old docs state that reckless drivers may not ignore lane connections, but can ignore lane arrows... sounds odd?

EDIT: This is for detailing, to allow user to do roadworks, etc., within limitations of current system. In new system, with extra lane arrows, they could use deflect/merge/diverge arrows.

originalfoo commented 5 years ago

U-turns

As per #32, should U-turns tool be moved to this Lane Routing tool?

It could be icon in centre of road.

Either side, if applicable, could be icons for "Stay on lane" (one in each direction) feature.

If #51 is implemented, the buttons for u-turn and stay-in-lane would be besides the build bar (like where the curved roads buttons are on roads menu).

originalfoo commented 5 years ago

Pondering data structure

For lane arrows/routing, an 8-bit word of flags...

Bit:

Deflect, merge and diverge relate to left/right. If there's no left/right flags then deflect/merge/diverge are not applicable.

The merge/diverge features can be used to create roadworks; even if there are lanes ahead, traffic can be told to merge in to adjacent lane. After the road works, user places a diverge allowing traffic back in to the lane.

Under the hood, all these things really just relate to lane connectors. Where we can determine standard lane connectors, it will save a lot of data in savegame if we just store the applicable lane arrow bitmask rather than a bunch of lane connection data.

originalfoo commented 5 years ago

UI Mockup

Please excuse the shit diagram ;)

routing

Quite a lot of changes here, as you can see.

Less right-clicking

Now that we differentiate between incoming (square) and outgoing (triangle) nodes, there's no need to hide incoming nodes when routing a specific node.

Right click can still be used to deselect the current source node, however users can now simply click a different source node to route from that instead.

Squares:

Triangles:

Note: To further distinguish between squares and triangles, the squares could be flush with the end of the road segment (like bottom and right in the image above) and triangles could be offset from the road edge (like right segment in image above).

As I add custom lane routes, the source lane arrows are updated accordingly to best match the connections.

Lane arrows

I need to spend some time pondering the interaction model of this, but initial ideas jotted below...

When a source (filled square) is selected, the lane arrows palette appears, filtered to valid arrows for that source lane.

In any case where current connections for a lane match a standard lane arrow, the connection lines go thin white to indicate a standard set of connections. This is on a lane by lane basis. It makes it easy to see which lanes are using normal road/highway rules (those with thin white line connectors) and which are using customised rules (thick coloured lines).

originalfoo commented 5 years ago

Roundabout automation

Doing lane connections or arrows for roundabouts is tedious. Is there some way we can automate?

Specifically, this would be a "conflict mitigation" approach (see #4) where things like automatic filter lanes would be added to the segments of the roundabout.

The key problem is detecting a roundabout, although we could just let the user select the segments or junctions manually as an interim measure.

Note: @joaofarias was working on a roundabout detection algorithm back in the days of T++. I don't know if he ever uploaded it to github, but it might be lurking in a branch or tag of https://github.com/joaofarias/csl-traffic

originalfoo commented 5 years ago

Copy and paste

A tool to copy/paste lane routing/arrows from one junction to any matching junctions.

Some nightmares here from code perspective, in that we'd need to deal with junctions facing different angles, making sure the number of lanes match, etc. Could potentially be simplified by looking at road names, priority routes, etc., of the copied junction? But what about pasting to junctions on other routes - icky.

kvakvs commented 5 years ago

The lane connector tool (where you drag colored curves) has a function (even now in TM:PE 10.20) called "Stay in Lane" (keyboard Shift+S) which connects all incoming lanes on a segment to all lanes on another segment. But from what i know it is simplistic and only works on nodes where there are exactly 2 road segments with same amount of in/out lanes.

What you want is probably just smarter and improved Stay in lane behaviour, where it would assign each outgoing lane say clockwise to each corresponding incoming lane counter-clockwise, even if more than two segments are present. That's exactly the situation with roundabout exits and highway exits/ramps, i.e. there are 3 segments and regular Stay in lane won't work.

originalfoo commented 5 years ago

There were some ideas going in that direction in this issue: https://github.com/krzychu124/Cities-Skylines-Traffic-Manager-President-Edition/issues/325 - There could be several 'helper' shortcuts that would achieve common lane usage patterns.

So the roundabout situation, for example, would be Shift + R or something like that. Remember that sometimes people would use one pattern or another as a starting point for further manual customisations.

kvakvs commented 4 years ago

When setting lane connectors or lane arrows, we can highlight possible routes from there for a few segments, this will help people see if their lane connector is what they mean it to be and is not sending traffic entering a road straight into a next exit (For example) because there isn't a node to change lane

originalfoo commented 4 years ago

638, #632 have implemented Reset button and Delete key shortcut for resetting Lane Arrows.

kianzarrin commented 2 years ago

I have made the following lane connection. image

routings seem a bit odd. image The selected target lane is white.

tagging @aubergine10 @krzychu124

originalfoo commented 2 years ago

I'm assuming image above is via routing diagnostic tool? If so which lane is mouse over in that second image?

Also, what do you mean "SOS(yellow)"? Is the color of small lane end circles indicating vehicle restrictions or something?

kianzarrin commented 2 years ago

@aubergine10 The white lane is the selected target lane. I have not hovered over any lane. the circles show all backward transitions from other lanes to the selected target lane. yellow is relaxed transition which is used by SOS vehicles. you can try it!

originalfoo commented 2 years ago

So in the image above, I assume there shuold be blue lane end circle between the other two (because vehicles can go straight ahead due to lane arrows) and the road entering from bottom should also have a lane end circle on its outer lane? At least that's what I'd assume would be happening as an end user based on the lane arrows/connector setup at that junction.

But in reality the outer lane of bottom road will only connect to the outer lane of roundabout (the inner lane of bottom road would normally connect to middle and inner lane of roundabout but it's been limited to just the inner lane due to lane connector). Is that correct? And I still don't get why the middle lane of roundabout on left doesn't connect to middle lane of roundabout on right.

kianzarrin commented 2 years ago

No the middle lane of the round about should go to the outer lane of the roundabout. I think there should be a yellow circle in the middle lane of the roundabout. as for the connecting road, there should be a blue circle on the outermost lane but that might be hard to calculate.

kianzarrin commented 2 years ago

I think this is partly because sometimes routings do not want to go to a lane that already has routings. this is because in the past lane connections used to be bidirectional and I wanted to stay backward compatible with train station connections.