Tmpe: Prevent players from setting invalid lane arrows

Created on 8 Jun 2019  路  18Comments  路  Source: CitiesSkylinesMods/TMPE

Description

Players should not be able to set lane arrows that do not point to an outgoing segment.
For example, in issue #361 the player mistakenly used straight lane arrows where the angle between the 4-lane highway and 8-lane road with median requires a right pointing arrow.

Technical Info

  • Lane arrow logic is one of the features that is still handled by the legacy Flags class. We could use this opportunity to move the code to LaneArrowManager.
  • LaneArrowManager:

    • Implement logic to check which kind of lane arrows may be set for a given segment end

    • Implement logic to correct invalid lane arrows

    • Make ToggleLaneArrows() call SetLaneArrows()

    • SetLaneArrows(): Check if the intended lane arrow is valid

    • HandleValidSegment(): (gets called when a segment is updated) Make sure that old lane arrows are valid. If not, call correction code.

  • LaneArrowTool: Disable/Remove invalid lane arrow toggle buttons
LANE ROUTING Overlays UI adjustments required enhancement

Most helpful comment

Lane arrows and lane connections have different semantics. Lane arrows are thought to be less restrictive. Lane connections on the other hand cannot be ignored by vehicles. Thus, as of now you cannot represent lane arrows as lane connections.

Some use cases for "soft" lane arrows which cannot be covered by lane connections currently:

  • the player can set that busses may ignore lane arrows if necessary
  • Vehicles must be able to ignore lane arrows when they set off (think of a cemetery which is placed next to a junction)

I also think that showing so many lane connections would clutter the UI.

All 18 comments

It would be nice if when user is changing lane arrows we also show the lane connector lines, so they can see precisely what lane connections are being made based on their arrow settings.

IMO in all cases the lane arrows should really just be setting the lane connectors, and then lane routing at every node is purely based on lane connectors all the time = less branching. It would mean pathfinder, etc., only ever needs to consider the lane connections; all uncustomised nodes would be given default lane connections (and a flag stating that they are not user-defined) so 100% of lane routing is connection based.

Lane arrows and lane connections have different semantics. Lane arrows are thought to be less restrictive. Lane connections on the other hand cannot be ignored by vehicles. Thus, as of now you cannot represent lane arrows as lane connections.

Some use cases for "soft" lane arrows which cannot be covered by lane connections currently:

  • the player can set that busses may ignore lane arrows if necessary
  • Vehicles must be able to ignore lane arrows when they set off (think of a cemetery which is placed next to a junction)

I also think that showing so many lane connections would clutter the UI.

On complex junctions, where there are say 6 segments connected to a node, some at strange angles, it is often difficult to discern exactly where traffic will go based on lane arrows alone. For precisely this reason I no longer use lane arrows feature and instead always use lane connectors feature.

In terms of cluttering UI, this would not be an issue if only the 'active lane' gets the connector line display. For example, user hovers the lane arrow panel for lane X, only the lane connectors for lane X are shown.

Lane arrows then become just a quick alternate way of setting lane connectors.

Instead of ignoring lane arrows, the relevant mod options would ignore lane routing (ie. lane connectors).

And, with everything now using lane connections the pathfinder & vehicle AIs have a single source of truth for routing through nodes.

On complex junctions, where there are say 6 segments connected to a node, some at strange angles, it is often difficult to discern exactly where traffic will go based on lane arrows alone. For precisely this reason I no longer use lane arrows feature and instead always use lane connectors feature.

Yes, lane connections are better suited for complex junctions. But setting lane arrows requires less clicks.

In terms of cluttering UI, this would not be an issue if only the 'active lane' gets the connector line display. For example, user hovers the lane arrow panel for lane X, only the lane connectors for lane X are shown.

:+1:

And, with everything now using lane connections the pathfinder & vehicle AIs have a single source of truth for routing through nodes.

Path-finder already has a singe source of truth! Let me explain:

Both lane arrows and lane connections are already translated into another data structure called "lane transition". The transformation is done by RoutingManager and path-finding is only dependent on lane transitions. From a logical point of view lane transitions look very similar to lane connections: They "connect" two lanes with each other. But they also carry more information:

  • Lane transitions are directed (where lane connections are undirected)
  • They hold a property called type which describes whether a transition may be used by certain vehicles:

    • Default transitions can be used by all vehicles. They normally come from set lane arrows and simple transitions between segments.

    • LaneConnection transitions have equal semantics like Default transitions. They are created for every lane connection.

    • Relaxed transitions can only be used by reckless drivers, emergency vehicles on duty and when a car sets off (at the first segment only).

  • They also hold path-finding related data, e.g. a cost indicator

To sum it up, lane transitions could be drawn as they were lane connections in the lane arrow tool. And probably also in the lane connector tool.

It would be great if the lines that represent lane transitions could have a distinct style, maybe as dashed arrows?

The plan was to use thin white lines for arrow-based connections transitions, and thicker coloured lines for connector-based connections transitions.

transitions

In image above (from #41):

  • Squares = entry lanes

    • Filled = there is at least one route _from_ that lane (forgot to fill the other squares at bottom)

  • Triangles = exit lanes (triangle points in direction traffic will take)

    • Filled = there is at least one route _to_ that lane

    • Yellow = depicts u-turn options

  • Colored lines = lane connector tool transitions
  • White lines = lane arrow based transitions

    • We could have dashed line version that depicts Relaxed transitions

When applying lane arrows, only the current lane transitions would be shown. When applying lane connectors, all transitions would be shown but with any arrow-based transitions in the thin white style.

On the existing routing manager stuff for lane transitions, are there flags denoting things like u-turns applied either via mod option or junction restriction?

No, but we can add new transition types for these

There's also the "lane change at junctions" thing too. I guess that would just alter the arrow-based transitions and thus be reflected in the lines drawn for those.

This is going to be a hell of arrows. xD

I like the idea of the arrows. The one reason I (like Aubergine) never use the lane arrows tool is that I can't see which roads it means. As you might be able to see in the top right of this image (it was taken for a different purpose) both arrows on Charles Street point right, because it understands the medium industrial road it connects to as also being a right turn instead of straight. (Another thing that would be nice is to force arrows, e.g. tell the game that yes, that road does in fact lead straight into the other one, even if it automatically shows the junction as being a right turn.
Screenshot 28

Currently the lane arrows can't be changed if lane connection lines were added. It might be nice if, when lane connectors are present, the arrows can be visually changed but have no effect on the lane routing?

Currently the lane arrows can't be changed if lane connection lines were added. It might be nice if, when lane connectors are present, the arrows can be visually changed but have no effect on the lane routing?

It might be a helpful workaround, yes.

It would be nice if we had separate issues for your feature requests such that we can track and work on them separately.

Pretty much the whole thread is about feature requests; might be easier to copy OP to new issue?

I can have a look and maybe move some of mine in a bit... got to catch a train atm though.

From #391:

60309724-943cf600-994f-11e9-942a-38909378b686

@aubergine10 the #391 will prevent players from setting invalid lane arrows
BUT
if the player moves the other segment end, so that it falls into a different quarter of the circle, the arrows might stop working, does Move It! mod and the game handle that? I hope so.

No it doesn't - TM:PE should ideally detect any changes to the roads (eg, moving, adding, bulldozing, etc) and maybe flag up with an overlay to indicate if settings have become broken as a result?

Quboid is in the Skylines.code discord so you can ask directly if you need any infos on Move It mod.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aubergine10 picture aubergine10  路  39Comments

22Pilots picture 22Pilots  路  27Comments

kianzarrin picture kianzarrin  路  32Comments

VictorPhilipp picture VictorPhilipp  路  34Comments

aubergine10 picture aubergine10  路  29Comments