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] Crossing the Lane/Road #1223

Open
4 tasks
originalfoo opened this issue Dec 9, 2021 · 6 comments
Open
4 tasks

[EPIC] Crossing the Lane/Road #1223

originalfoo opened this issue Dec 9, 2021 · 6 comments
Assignees
Labels
DLS Dynamic Lane Selection EPIC Collation of related issues EVE Emergency Vehicle Evasion JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors PARKING Feature: Parking AI / restrictions / etc PATHFINDER Pathfinding tweaks or issues

Comments

@originalfoo
Copy link
Member

originalfoo commented Dec 9, 2021

Epic Work Items

Related Issues

The following issues may be resolved or made obsolete by the implementation of this epic.

Summary

This is an(other) attempt to collate general issues relating to where road vehicles can change lanes or cross the road, notably in relation to medians and lane directions. These issues could also apply to rail, tram, monorail, etc., but the focus here is road.

Over the years loads of issues have amassed, many are duplicate or related. Purpose of this Crossing the Lane/Road issue is to try and get everything in one place, as coherently as possible, and then close all the other linked issues to declutter the issue tracker.

@originalfoo originalfoo added EPIC Collation of related issues PARKING Feature: Parking AI / restrictions / etc JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues EVE Emergency Vehicle Evasion DLS Dynamic Lane Selection labels Dec 9, 2021
@originalfoo
Copy link
Member Author

originalfoo commented Dec 9, 2021

Segments

Medians

Issues: #89 , #192 , #503 , #504 , #243 , #1220 , #515

The game has no concept of medians or other "barriers" between lanes.

  • Medians are most commonly found in middle of 2-way roads, but can also appear between lanes travelling same direction
  • There can be more than one median on a road (example: Queens Blvd).
  • There are two types of median: flat and barrier. A flat median might just be a big gap between lanes (eg. filled with diagonal line decal), a barrier median could be a raised pavement, etc. Differentiating the two could allow "responding" emergency vehicles (and some service vehicles, eg. hearse, disaster recovery, etc) to cross flat medians.
  • While a median might sometimes have a corresponding lane (eg. a ped lane, etc) it's totally at the whim of the asset creator.
  • A lane which is lane type None and vehicle type None is not necessarily a median; it could be used for some other purpose (eg. for adding inter-lane props, etc).
  • Users can dress normal lanes up as medians, for example "filling" them with raised pavement using the Intersection Marking Tool and/or using lane connectors to prevent access to the lane. See also Lane customiser: Direction, and type #515

Suggestions:

  • Some way to ensure each median is associated with a lane (creating lane if necessary)
  • Some way to flag the lane as median (and ideally differentiate flat vs. barrier)
  • Road traffic should never cross a 'barrier' median lane (and m_CanCrossLanes set accordingly)
  • Some way for users to set a normal road lane to be a median (mods such as IMT & CMJ, could dress up the road and junctions accordingly)

Lane direction

Issues: #89 (first image)

We can't assume lanes in one direction are grouped together on one side of the road, or even the 'usual' side of the road:

  • Sometimes there are alternating lane directions in a road (eg. forward, reverse, forward, reverse)
  • Sometimes two lanes, going in different directions, overlap (sometimes found in 'turning lanes' of road assets)
  • Sometimes lanes use direction both (sometimes found in 'turning lanes' of road assets, and also parking lanes)
  • Some roads have 'reversed' lanes; eg. to facilitate some modern motorway intersections where traffic drives on "wrong side of road"

Suggestions:

  • Order lanes by position (see Lane Sequence heading below)

Lane sequence

Issues: #786

There doesn't appear to be control over the order in which lanes are defined (eg. from left to right); it's possible for assets to jumble them up. For example, in #786 (comment) ped lanes on opposite side of road are adjacent to each other in the data structure (lanes 7 & 8).

This makes it painful to determine if going from lane A to lane C is going to cross a median or oncoming traffic.

Suggestions:

  • Some way to sort lanes based on their location across the road (and cache the result)
  • That will make it clear what the adjacent lanes are for a given lane, and whether they are uncrossable
  • If we had custom data structure, we could possibly group lanes (eg. group number would change each time a median, parking lane, ped lane, or direction change is encountered)

m_CanCrossLanes

As noted in #1220 (comment) :

Can Cross Lanes flag is applied to segment, to prevent cargo vehicles crossing the median when they deliver goods, it has nothing to changing lanes for normal vehicles,

Suggestions:

  • Ensure this flag is always set correctly (see also Median detection #503):
    • One or more medians = no cross
    • One-way road = no cross?
      • although... allowing cross could possibly overcome some bad road design issues, eg. vehicle not able to get in required lane due to lack of lane change points?
    • Large road, Highway = no cross
    • More than x (2?) lanes in other direction = no cross
    • Alternating lane directions = no cross
    • Any "in road" ped or parking lanes = no cross
  • If not can cross lanes, vehicle has to path to the lane adjacent to destination (ie. take the long route)

Access to buildings

Issues: #506 (EPIC), #19 , #10 , #189 , #135 , #558

As noted in #19 (comment) :

Building entry/exit nodes can only point to a single road lane (NetNode.m_lane). That's the segment lane which is used by vehicles to enter/exit a building.

It's common to see vehicles driving past destination, just on other side of road, and then they have to go find somewhere to turn and come back again; if they could just cross the road it would save much time.

Suggestions:

  • Allow m_CanCrossLanes to cover non-cargo vehicles
  • When pathing, if reached segment that contains target lane and can cross lanes, cross the road

Access to parking lanes

Issues: #189 , #551

Similar to building access, but for parking lane access.

  • Vehicles being able to cross road to reach parking lane on other side could reduce paths to parking
  • Can't assume a parking lane of given direction (or both) is adjacent to normal lanes of that direction
  • Can't assume it is at the outer edge of the road; eg. it could be in middle of road near center BRT lanes

Suggestions:

  • When pathing, if reached segment that contains target lane and can cross lanes, cross the road

Cross after spawn

Issues: #505

Vehicle paths could be reduced if they were able to cross road upon spawning, assuming safe to do so.

Suggestions:

  • If can cross lanes on segment where spawning to, pathing could start from closest lane going in general direction of destination?

Should wait for gap in traffic

Issues: #135

Vehicles should wait for a gap in oncoming traffic before crossing oncoming traffic lanes. If we can find a way to do that, it could possibly facilitate things like #1193 .

  • What happens if there's no gap; traffic jam - how to resolve?
  • Could force oncoming traffic to wait? (eg. front car stops, flashes headlights to signal ok to cross)

@originalfoo
Copy link
Member Author

originalfoo commented Dec 9, 2021

Nodes

Lane changes need to respect medians, where applicable.

I'm using terminology from Node Controller Renewal mod.

Middle, Bend

Issues: #89 (OP)

  • Vehicles should not be crossing medians, ped lanes, parking lanes, or oncoming traffic lanes on these nodes
  • They should stay within their "lane group" (as mentioned in Lane Sequence heading above)

U-turn, Stretch, Custom, Crossing

  • Gaps in medians can occur (or be filled, eg. with Kian's Continue Junction Median mod) at these nodes
  • Control over medians gaps = control over pathing between "lane groups"

Example: A Queens Blvd style road could gap ouer medians between, but keep solid central median. That would allow traffic to path from outer lane group to inner lane group, but not cross to the other side of road (as central median would block).

Junctions

Issues: #646 (Roads heading in OP)

  • Similar to above; control over gaps in medians = control over pathing/routing between lane groups of the segments attached to the junction
  • External mods would generally handle the addition/removal of medians across the junction node, however road assets sometimes do that as well (eg. add traffic lights = gap in central median)
  • Notably, however, on two-way highways, the median should be retained by default and traffic should not be able to cross oncoming motorway traffic (see image here: Make m_CanCrossLanes work intelligently #646 (comment) )

Automation / UX

Ideally, for nodes which facilitate "gappable" medians, it would be great if TM:PE (or external mod) could automatically set up lane connectors, etc.

It would be spectacular if user could simply click medians (or thier outlines) to toggle them on/off, and have lane routing, etc., update accordingly. This approach would be especially desirable in cases where there might be multiple medians (eg. Queens Blvd) .

Ped Crossings

With the concept of lane groups and identifiable medians (which could have ped lanes added if not already present), we could possibly have staggered ped crossings. In other words, a ped crossing could be set to cross specific lane group(s), the cim would cross to a median, walk along it, to get to next ped crossing over the next lane group, etc.

Junction Restrictions / Priority Signs / etc

Again, with lane groups, we could potentially apply junction restrictions, priority signs, traffic lights, etc., per lane group.

Ability to define a lane as a filter lane (see also #515) could separate it in to its own lane group.

Dynamic Lane Selection

Would need updating to stay within lane group. Given that road of same type should have same lane groupings from one segment to another, it should be feasible for DLS scan-ahead to handle that?

@Elesbaan70
Copy link
Contributor

Elesbaan70 commented Dec 9, 2021

Here's my take, from a player's perspective, not knowing the modding side so well (yet).

Trying to detect medians on existing road assets, as it turns out, is a fool's errand. All the great feedback in #1220 showed me that.

We could flag a lane as a median, but my gut tells me this would be too limiting, and might even be harder to implement than another option:

  • Asset Design

    • Through Adaptive Roads, give each lane a pair of properties identifying who is allowed to move leftward or rightward from that lane. This could be None/Emergency/All, or it could be more granular if it makes sense and is feasible.
  • Traffic Logic

    • The code would be revised so that when leftward movement is disallowed:

      1. No vehicle can change lanes leftward from that lane.
      2. No vehicle can access buildings on the left side of the road from that lane or any lane to its right.
      3. At nodes where turns are allowed, if there are more lanes to the left which travel in the same direction as the lane in question, then left turns are not allowed from this lane or any lane to its right. This can be overridden by the Lane Connector.
      4. Disallowing rightward movement would have the corresponding effects in the opposite direction.
    • Where a node implies a gap in the median, turns, including U-turns, would be allowed when applicable, but otherwise crossing these boundaries would still not be allowed. This may seem counterintuitive, but it is how roads of this kind tend to work. A turn at a designated location is actually safer than changing lanes across a median boundary at a gap not specifically designed for that purpose.

    • The ability to U-turn into a lane that can access buildings on the opposite side implies the ability to access buildings on the opposite side via the node.

  • In-Game Configuration

    • Update the Lane Connector so that it prevents disallowed lane changes unless the node implies a gap in the median. In this case, the Lane Connector would allow exceptions to be made to all disallowed movements.
    • Consider adding U-turns to the Lane Connector.

Related Enhancements

The roads will not work the way people expect unless vehicle behavior can be altered appropriately. My suggestion is to add a "Lane Avoidance Level" property in Adaptive Roads.

  • 0 would be the current behavior.
  • 100 would mean that vehicles always wait until the last possible opportunity to move into this lane to reach their destination (except emergency vehicles, which do whatever they need to).
  • Values inbetween would go into a formula that uses some kind of sensible evaluation of factors to decide whether to use the lane, with the likelihood that the lane will get used going down as the number increases. Maybe the logic that considers total travel time can have its numbers altered by this property.

Once this is implemented, asset makers would learn how to find the best number for the work they're doing. An interesting use case for this feature would be center turning lanes, which would allow traffic both directions and have a lane avoidance level of 100.

Enhancements that would be cool but won't ever happen

Queens Boulevard has stop signs and stoplights on the ramps from the center (express) roadways to the outer (local) roadways. So we're basically talking about a stop between lanes instead of between streets. This is obviously paradigm-breaking and probably not feasible in the slightest. But it would be cool. 😎

@Elesbaan70
Copy link
Contributor

Elesbaan70 commented Dec 9, 2021

One more thought on this. If the implementation of a new lane movement control system is treated as its own project, then it really does simplify the median detection problem by allowing you to focus on that specifically. Knowing that the logic is there and does what it needs to, you can go in and start knocking out the specific scenarios piecemeal, carefully evaluating and testing each one.

For example, it looks like the case of pedestrian or parking lanes between vehicle lanes is an easy one, and maybe the first where you'd just programmatically apply restrictions to the nearest vehicle lanes when the asset is loaded.

Another case are vanilla assets and stable, popular workshop assets that are known to have medians. They could just be detected and altered at runtime right away.

@Elesbaan70
Copy link
Contributor

#1528 addresses some of what this issue covers. It is use case focused, rather than trying to be a general median solution.

@Elesbaan70
Copy link
Contributor

@aubergine10 My ongoing displaced lane work has come upon challenges that have led me to realize that I really need to replace #1392 and #1528 with a group of smaller enhancements under a single epic. Turns out the epic already exists right here, so I'll be adding new issues under this. 🙂

@Elesbaan70 Elesbaan70 self-assigned this Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DLS Dynamic Lane Selection EPIC Collation of related issues EVE Emergency Vehicle Evasion JUNCTION RESTRICTIONS Feature: Junction restrictions LANE ROUTING Feature: Lane arrows / connectors PARKING Feature: Parking AI / restrictions / etc PATHFINDER Pathfinding tweaks or issues
Projects
None yet
Development

No branches or pull requests

2 participants