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

Prevent players from setting invalid lane arrows #368

Closed
VictorPhilipp opened this issue Jun 8, 2019 · 18 comments · Fixed by #1724 · May be fixed by #391
Closed

Prevent players from setting invalid lane arrows #368

VictorPhilipp opened this issue Jun 8, 2019 · 18 comments · Fixed by #1724 · May be fixed by #391
Labels
adjustments required An issue require some adjustments in code enhancement Improve existing feature LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. UI User interface updates

Comments

@VictorPhilipp
Copy link
Collaborator

VictorPhilipp commented Jun 8, 2019

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
@VictorPhilipp VictorPhilipp added feature A new distinct feature triage Awaiting issue categorisation enhancement Improve existing feature and removed feature A new distinct feature triage Awaiting issue categorisation labels Jun 8, 2019
@originalfoo
Copy link
Member

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.

@VictorPhilipp
Copy link
Collaborator Author

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.

@originalfoo
Copy link
Member

originalfoo commented Jun 9, 2019

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.

@VictorPhilipp
Copy link
Collaborator Author

VictorPhilipp commented Jun 10, 2019

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.

👍

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?

@originalfoo
Copy link
Member

originalfoo commented Jun 10, 2019

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.

@originalfoo
Copy link
Member

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?

@VictorPhilipp
Copy link
Collaborator Author

No, but we can add new transition types for these

@originalfoo
Copy link
Member

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.

@VictorPhilipp
Copy link
Collaborator Author

This is going to be a hell of arrows. xD

@AsherWentworth
Copy link

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

@originalfoo
Copy link
Member

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?

@AsherWentworth
Copy link

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.

@VictorPhilipp
Copy link
Collaborator Author

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

@originalfoo
Copy link
Member

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

@AsherWentworth
Copy link

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

@originalfoo
Copy link
Member

From #391:

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

@kvakvs
Copy link
Collaborator

kvakvs commented Jul 8, 2019

@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.

@originalfoo
Copy link
Member

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.

@originalfoo originalfoo added LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. UI User interface updates adjustments required An issue require some adjustments in code labels Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adjustments required An issue require some adjustments in code enhancement Improve existing feature LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. UI User interface updates
Projects
None yet
4 participants