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

An option to enhance the behavior of the Can Cross Lanes road asset flag #1220

Closed
Elesbaan70 opened this issue Dec 6, 2021 · 47 comments
Closed
Labels
feature A new distinct feature LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues triage Awaiting issue categorisation

Comments

@Elesbaan70
Copy link
Contributor

Elesbaan70 commented Dec 6, 2021

I would like to see an optional setting which would alter the behavior of the Can Cross Lanes road asset flag as follows:

  • Any non-vehicle lane that has vehicle lanes on both sides of it is considered a median.
  • When the Can Cross Lanes flag is cleared, in addition to the current behavior, vehicles cannot cross any non-vehicle lane that has been designated as a median, unless such a crossing has been explicitly authorized using the lane connector.

This is different from the standard behavior, in which vehicles simply cannot cross over the oncoming lanes to reach their destination, without going to an intersection.

This would allow the creation of roads with multiple medians, like Queens Blvd in NYC. Ramps connecting the express and local roadways could be configured using the lane connector, and rendered using the Intersection Marking Tool.

Screenshots?

image

Notes or questions?

Simply using the lane connector to restrict vehicles to the proper roadway wouldn't be any good, because emergency vehicles ignore it.

A possible alternative approach is to add a flag to the lane connector imposing its rule on emergency vehicles on a node-by-node basis. To really be usable, there would also need to be a shortcut similar to "Stay in lane" to easily set up lane connections that don't cross non-vehicle lanes.

Tagging #89 , #192 , #503 , #504 , #558 , #506 , #64 , #646

@Elesbaan70 Elesbaan70 added feature A new distinct feature triage Awaiting issue categorisation labels Dec 6, 2021
@Elesbaan70
Copy link
Contributor Author

I'm willing to actually do this work. I know what I'm doing, but I would need guidance in how CSL modding works and where the right pieces are to make this happen.

@kianzarrin
Copy link
Collaborator

Any non-vehicle lane that has vehicle lanes on both sides of it is considered a median.

Cool idea.

I also have a mod that can detect if there is median based on mesh. But I think your idea is good enough.

@Elesbaan70
Copy link
Contributor Author

Interesting. Does this mod achieve what I'm looking for, and is it compatible with TM:PE?

I think doing it based on lane configuration would have advantages. It's nice not to be dependent on the shape of the road surface (assuming that's what you mean).

@originalfoo
Copy link
Member

originalfoo commented Dec 6, 2021

Tagging #89 , #192 , #503 , #504 , #558 , #506 , #64 , #646

@originalfoo originalfoo added PATHFINDER Pathfinding tweaks or issues LANE ROUTING Feature: Lane arrows / connectors labels Dec 6, 2021
@originalfoo
Copy link
Member

If this gets implemented (I hope so, love the idea - see tagged issues above) note that some roads have very strange lane configs, for example an empty lane that spans entire width of road, or empty lanes that just seem randomly placed... Would possibly need some way for user to interact with the lanes of a segment to indicate certain lanes should be ingored, etc. Width of lane would also need investigating, for example I suspect the UK roads with cat's eyes use prop lanes between each vehicle lane to place the props along the road; those should still be crossable.

@kianzarrin
Copy link
Collaborator

@aubergine10
for those weird roads we can use my median detection code based on mesh outline.

@krzychu124
Copy link
Member

I don't have much to add to what @aubergine10 already said. Many tried, everyone failed. It's way more complicated than you might think.
Good luck 🤞🙃

@originalfoo
Copy link
Member

#243 was a past attempt, likely worth looking at in any future attempt

@originalfoo
Copy link
Member

Regarding Qeens Blvd image in OP, how do we keep traffic out of the outer access lanes unless it's planning to park/deliver there? Otherwise there will be loads of traffic using those lanes as a through-route just like all the other lanes.

Maybe an "redsidents/deliveries only" vehicle restriction, or make the lanes appear congested so pathfinder generally tries to route around them?

@originalfoo
Copy link
Member

@kianzarrin does this new mod cause issues with your median detection? curb height adjuster

@kianzarrin
Copy link
Collaborator

I thought of that too

@Elesbaan70
Copy link
Contributor Author

Regarding Qeens Blvd image in OP, how do we keep traffic out of the outer access lanes unless it's planning to park/deliver there? Otherwise there will be loads of traffic using those lanes as a through-route just like all the other lanes.

Does speed limit help with this? The speed limit will be lower on the local roadways than on the express roadways. It could be set quite low (within reason) if that would help.

Maybe an "redsidents/deliveries only" vehicle restriction

This won't work because the local roadway doesn't really work that way. For example, the express roadway may not allow a right turn; rather, you would have to take a ramp to the local roadway and turn right from there. Also, some minor cross streets only connect to the local roadways.

or make the lanes appear congested so pathfinder generally tries to route around them?

Sounds kludgy. ;-)

@originalfoo
Copy link
Member

Slow speed limit would certainly help, and with the new speed limits UI that's currently being tested it will be vastly easier for users to set/change default speed limits of lanes (eg. so speed limit approach would work well for existing assets).

@Elesbaan70
Copy link
Contributor Author

Elesbaan70 commented Dec 7, 2021

Thanks for the feedback, everyone!

I want to avoid scope creep. It would be cool if this could solve all existing median-related problems, but I already suspected that it was just as likely to create problems as to solve them. That's why I proposed it as an optional setting.

This discussion, and #243, have shown me that there are too many things that could go wrong. This feature won't be much good if no one can enable it because of the problems it causes. My gut is telling me not to do it this way.

That leaves us with a couple of alternative options that I can think of:

Option 1: Just use the Lane Connector

In this case, the lane connector would need a flag on the node saying that it applies to all vehicles (including emergency vehicles and anything else otherwise exempt). And for usability, a shortcut to create sensible lane connections that don't cross non-vehicle lanes.

Option 2: Devise a way to configure the lanes on the road asset itself

This is by far the better solution, but I already know enough to know that it's not an easy one. The mods and assets I've seen suggest to me that we can't add our own properties to a road asset. I hope I'm wrong about this, because that would be the logical and straightforward way to do it.

Assuming that is not an option, I suggest that TM:PE add two dummy props at runtime: A Lane Movement Control prop, and a Delayed Lane Usage prop. Ideally these would get their own category in the Asset Importer dialog, but they could just be in the Roads category if necessary. They would render nothing, but TM:PE could detect them and use their settings as follows:

Lane Movement Control

  • Flags Forbidden: Left - Prevents leftward movement out of this lane, except for a left turn onto another road, or a U-turn where these would normally be allowed. Prevents leftward lane changes. Prevents access to buildings on the left side of the road from this lane or from any lane to its right.
  • Flags Forbidden: Right - Same as above, but reversing left/right.
  • Both flags can be applied to the same lane.
  • The lane connector always takes precedence over the rules established by this prop.

Special attention to how this interacts with left-hand driving may be needed.

Delayed Lane Usage

  • Probability - Indicates how likely vehicles are to avoid this lane. 100 means wait to use this lane until the last opportunity. The lower the probability of lane avoidance, the more often vehicles will use the lane to avoid traffic, with 0 basically nullifying the prop's effect. Note that this is a "probability" in the sense of how strongly the algorithm disfavors the lane in relation to other factors, mathematically speaking. It is not a random element.

This prop would also be great for center turning lanes.

@Elesbaan70
Copy link
Contributor Author

One more thought: It would probably make sense to automatically apply the Lane Movement Control prop's effect at runtime to the inner lanes of any road asset where Can Cross Lanes is unchecked. That way, the same logic can be used on all roads.

@originalfoo
Copy link
Member

Adding props carries its own problems - eg. what if road is moved using Move It, or bulldozed, etc... props need to respond accordingly.

To avoid changes to pathfinder, the goal would be find some way to semi-automate (user would still need to choose where traffic can join/exit) lane connectors and speed limits in relation to medians and the distinction between local/regional traffic lanes.

I think Continues Junction Median and Adaptive Roads mods already cover some of the groundwork for what's required; namely being able to have custom road flags and toggle medians on/off.

@Elesbaan70
Copy link
Contributor Author

The idea for the props is that they are dummies, not rendering anything, which the person creating the road asset would add to the appropriate lanes to flag them as requiring special treatment by the pathfinder. They'd just be attached to the road asset itself, ready to be detected and acted upon by TM:PE, so moving and bulldozing wouldn't be an issue.

When placing the roads in your city, you wouldn't even be aware of them. You would just know that the medians are honored and the local roads used appropriately, and you would hopefully learn from the road asset descriptions that you should set up ramps using the Intersection Marking Tool, TM:PE's lane connector, and Node Controller Renewal. If this ever sees the light of day, I'll be creating guides and maybe YouTube videos for road asset creators and city creators.

I'll look more closely at the mods you mentioned, but I thought they were about rendering in response to TM:PE rules.

@originalfoo
Copy link
Member

Rather than props, something like Adaptive Roads custom lane flags would probably be better approach; asset authors can specify flags, then AR mod lets users toggle the flags in-game, but the flags can also be read by mods. Flags can be used to toggle meshes, props, etc. - Kian will be best person to clarify that.

Looking at the road in google maps, it's a nightmare... There's so many junctions/filters to the central lanes that their whole purpose - to bypass local traffic - is utterly defeated. There's a major junction every 2 blocks, and often a filter junction between every major junction lolol.

image

Would there need to be multiple prefabs, eg. one (two?) with the filter lanes, one without filters? How are things like stop lines - but only on the filter lanes - going to work? Currently stop signs in CSL (and TMPE) affect all lanes in specific direction on the segment.

@Elesbaan70
Copy link
Contributor Author

Elesbaan70 commented Dec 7, 2021

It's more about separating the thru traffic from the vehicles that are picking up and dropping off or trying to parallel park, the pedestrians, bicyclists, etc., rather than actually eliminating cross streets.

The stop signs (there are stoplights in some cases too), if achievable at all, aren't something I'm looking at doing initially if ever. On the real street, they're a relatively recent addition. You can see the remnants of the old ramp design in the pavement structure.

The ramps, or filter lanes, would be at nodes. The lane connector would govern the vehicle movement, and the Intersection Marking Tool would paint it. Here's a proof of concept I did:

image

My objective isn't a perfect recreation, though I think that's what the person who put the idea in my head was hoping for. I just like the general concept.

@krzychu124
Copy link
Member

Ok, to clear up one thing because I see one thing confuse a bit:

  • 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,
  • median detection should apply to nodes - that's where vehicles changing lanes (in 99% cases), Can Cross Lanes flag is not available there and some asset configuration may spawn continuous median that should not be crossable (but it is without forced lane connection) and also can be spawned on demand with @kianzarrin's mod, but only for specific roads that has mesh or can be generated (afaik)

@Elesbaan70
Copy link
Contributor Author

I'm going to step back from this and look for other smaller tasks to familiarize myself with modding Cities: Skylines before trying something this extensive.

I still want to come back to it, but I doubt that I would try to implement it as originally described. @aubergine10, since you liked the idea so much, does that mean it's all yours? 🤷‍♂️

@originalfoo
Copy link
Member

See #1223 which gives rough idea (which may or may not be valid) of what might be involved - median detection, creating/associating lanes with medians, ordering lanes by position on road, grouping lanes between medians, etc. In addition to that, UI would need updating, eg. lane connectors/arrows would need to limit to connectable lanes.

@kianzarrin
Copy link
Collaborator

@aubergine10

@kianzarrin does this new mod cause issues with your median detection? curb height adjuster

Not that I know of.

@kianzarrin
Copy link
Collaborator

@aubergine10 can we use None lane as median at middle nodes? what about vertical offset? what about mesh outline?
@Elesbaan70 said you know of examples that the above strategies will do more harm than good. but he cannot remember.

Someone came up with some examples of roads that had a "none" lane where there was no median intended.
The most common example was roads with cat eyes, but when I suggested checking the vertical offset, someone had an example of that too. I'll have to go find the conversation in GitHub.
Looking back at old discussions, I'm seeing a lot of me not knowing what I'm talking about 😆 and aubergine10 raising the concerns about using the "none" lane for median detection. But I'm not finding where I suggested checking the vertical offset. I could have sworn we talked about that. 🤔

@originalfoo
Copy link
Member

None lanes are quite common - eg. in decorative networks, but also in roads such as those in UK Roads Revived assets - an example of running in to that issue here: #1346

@Elesbaan70
Copy link
Contributor Author

None lanes are quite common

What about lanes (including pedestrian or bike lanes) that are at a different vertical offset? Do you know of a scenario where this would not indicate a median?

@kianzarrin
Copy link
Collaborator

kianzarrin commented Apr 9, 2022

@aubergine10 but is there any None lane in the middle of the road where the cars are supposed to cross?
EDIT: and that has a vertical offset different than car lanes?

@Elesbaan70
Copy link
Contributor Author

and that has a vertical offset different than car lanes?

If vertical offset is an indicator of median, I think the lane type won't matter. But in this case there would need to be a limit--a range in which a median is indicated. Otherwise elevated tracks could become an issue in some cases. (I believe most of them have their supporting structure directly underneath so it would function as a median, but the supports could be off to one or both sides.)

@kianzarrin
Copy link
Collaborator

@Elesbaan70 what is supports?

@Elesbaan70
Copy link
Contributor Author

The structure that holds up (supports) the elevated track -- pillars, walls, etc.

@originalfoo
Copy link
Member

originalfoo commented Apr 9, 2022

@aubergine10 but is there any None lane in the middle of the road where the cars are supposed to cross?

Yes, sometimes

EDIT: and that has a vertical offset different than car lanes?

What about lanes (including pedestrian or bike lanes) that are at a different vertical offset? Do you know of a scenario where this would not indicate a median?

Not that I am aware of. But...

As you know, creators use existing road as template. If that road has lanes they don't want, they will get rid of them in various ways - eg. just removing meshes/textures, setting None on properties, etc., sometimes actually deleting the lane, other times just leave it sitting there untextured.

It is possible (but not visible to end users without detailed invetigation) that there are road assets with raised lanes that used to be a median, that the creator just unmeshed/textured etc - from creator and user perspective, the road works. From our perspective we now have something that looks like median that isn't a median. In this situation, is that "possibly median" over actual road vehicle lanes? If there is already traffic lanes driving "under" the "possibly median" then it's not a median from creator/user perspective.

Other random thoughts:

  • I've only ever seen bike lanes at same height as road (a possible exception although not tested in-game), sometimes with a median either side of bike lanes.

  • A pedestrian / bike / parking lane between opposing directions of traffic lanes should always be treated like a median IMO. I've seen all those things appear in middle of workshop road networks. Adjacent ped/bike/parking lanes = even more "median-y" than a single one of those lanes.

  • The complexity comes when we have a "potentially median width" gap between road vehicle lanes with "nothing easily discernable" in that gap. If there's mesh in the gap that's > curb height then we can probalby assume a median. Otherwise we need to look at the width of the gap (eg. it could be painted median).

  • I don't know what point Curb Height Adjuster (CHA) mod kicks in, but if we want to use veritical offsets as a differentiator between road surface and pavement height we'd likely need to do that work before CHA kicks in, or at least take in to account the user config of CHA.

  • If a "not clearly defined" median can be detected, is there any way to allow pedestrians to walk on it if we can determine it's walkable surface (gravel, pavement, asphalt)?

  • I assume all of this is roads only, and will exclude tracks, quays, and all other types of network. For tracks, I'm aware of at least one asset (see 5th screenshot) that potentially has central mesh higher than tracks.

  • Medians not necessarily in middle of road; there are several asymmetric medians in workshop. And also not necessarily between opposing directions (eg. traffic on both sides of median might travel in same direction).

  • What about monorails above roads - are they part of mesh or something different?

  • Can we take cues from IMT - if user uses it to create a filled area (particularly if they choose gravel, grass, pavement, etc., as the fill) can we somehow detect that and say "this is median"?

@Elesbaan70
Copy link
Contributor Author

My goodness, I was clueless when I created this issue!

What led to the conversation being reopened was this:

image

But as someone else pointed out on Discord, it's not really a good example of the median detection problem, because the cars are also crossing opposing traffic. The routing manager ought to be smart enough to prevent this when Can Cross Lanes is disabled, and I'll probably have a look at it myself at some point.

But I will eventually return to the Queens Blvd style roads, and would like to see some kind of solution to the median detection problem.

@kianzarrin
Copy link
Collaborator

kianzarrin commented Apr 9, 2022

@aubergine10 but is there any None lane in the middle of the road where the cars are supposed to cross?

Yes, sometimes

Can you please give me example? without example its hard to come up with a solution.
never mind I just saw your examples.

@kianzarrin
Copy link
Collaborator

#1220 (comment)
@Elesbaan70 one can argue the asset has a bug because it does not uncheck CanCrossLanes.

@originalfoo
Copy link
Member

@aubergine10 but is there any None lane in the middle of the road where the cars are supposed to cross?

Yes, sometimes

Can you please give me example? without example its hard to come up with a solution.

I can't remember which asset it was. Next time I'm in game I'll test all the workshop roads I have - hopefully I still have it subscribed.

@originalfoo
Copy link
Member

But as someone else pointed out on Discord, it's not really a good example of the median detection problem, because the cars are also crossing opposing traffic. The routing manager ought to be smart enough to prevent this when Can Cross Lanes is disabled, and I'll probably have a look at it myself at some point.

As an interim measure, could we determine how many oncoming lanes a vehicle is trying to cross? If more than 1 lane, it should be treated as highly dubious.

one can argue the asset has a bug because it does not uncheck CanCrossLanes.

Correct, but many asset creators have no clue what most of the properties do, especially if they haven't discovered sites like cslmodding.info. It's often case of just fudging a template asset in to something that works for them, then share to workshop. And most road assets never get updated after being published.

@Elesbaan70
Copy link
Contributor Author

one can argue the asset has a bug because it does not uncheck CanCrossLanes.

Except it does

image

I just realized I'm gonna have to address this in the displaced lanes feature, since the bug is only relevant as a bug in that context.

@Elesbaan70
Copy link
Contributor Author

As an interim measure, could we determine how many oncoming lanes a vehicle is trying to cross?

This probably needs to be moved to the displaced lanes discussion, but I think a lane change across any oncoming lanes is dubious.

For purposes of lane changes (not turns/connections), I'm thinking it should work something like this:

  • CanCrossLanes==true, emergency vehicles can change lanes across oncoming traffic, others cannot
  • CanCrossLanes==false, no vehicles can change lanes across oncoming traffic

Correct, but many asset creators have no clue what most of the properties do, especially if they haven't discovered sites like cslmodding.info. It's often case of just fudging a template asset in to something that works for them, then share to workshop. And most road assets never get updated after being published.

I'm all for accounting for badly designed assets when we can, but we have to draw a line somewhere.

@originalfoo
Copy link
Member

Yes, but what does "can cross lanes" mean to someone who does't currently know what it means. While the term makes sense to us, it doesn't necessarily make sense to everyone else. Do most users know what "enable bending nodes" means?

This probably needs to be moved to the displaced lanes discussion, but I think a lane change across any oncoming lanes is dubious.

If it's vehicle cutting across oncoming traffic to change to different origina-direction lane via a non-junction node, then yes, that is weird af and probably should never happen.

If it's making a delivery to building on other side of the road, then it's fairly common in UK and much of Europe.

For purposes of lane changes (not turns/connections), I'm thinking it should work something like this:

* CanCrossLanes==true, emergency vehicles can change lanes across oncoming traffic, others cannot

* CanCrossLanes==false, no vehicles can change lanes across oncoming traffic

I always thought the flag was about "can deliver to building on other side of road" / "can leave building and go directly to other side of road to start journey".

@Elesbaan70
Copy link
Contributor Author

Yes, but what does "can cross lanes" mean to someone who does't currently know what it means. While the term makes sense to us, it doesn't necessarily make sense to everyone else. Do most users know what "enable bending nodes" means?

We're talking about asset creators, not just anyone. Assuming that no one knows how anything works will cripple any future development.

If it's making a delivery to building on other side of the road, then it's fairly common in UK and much of Europe.

Over a median? That's what we're talking about. That's the proper use of the Can Cross Lanes flag.

I always thought the flag was about "can deliver to building on other side of road" / "can leave building and go directly to other side of road to start journey".

Yes, but bear in mind that this was CO's solution to the median problem. Rather than trying to work out the existence of an actual median, they made crossing oncoming traffic the determining factor, and put a flag on the road asset to indicate whether this should be allowed. So displaced lanes are a new use case they had not anticipated, but it still fits.

@kianzarrin
Copy link
Collaborator

@Elesbaan70 it seems like when I brought up median detection a few months ago, that idea got shot down.

@aubergine10 @Elesbaan70 All the issues you raised are all interesting and valid points. But none of them are serious enough to abandon this task all together.

Even if we cannot detect all medians, detecting some medians is an improvement that is easily achievable. At least it would make it possible for asset creators to make TMPE friendly roads.

What would be a serious (but even then I still don't think its a blocker) obstacle is a false positive. I have not seen any such example.

I think detecting medians using elevated None lanes is an easy yet effective phase 1 for this issue (you can do 80% of the work in 20% of the time). Currently no one can create assets that prevents cars from crossing medians. After completing phase 1 at least informed asset creators will have a way to solve this problem. dealing with uninformed/old assets can come in later phases of this operation.

it probably would take me less time to write the code than to discuss it!!!!

@kianzarrin
Copy link
Collaborator

I always thought the flag was about "can deliver to building on other side of road" / "can leave building and go directly to other side of road to start journey".

yes that is what it currently does. but it does not make too much sense because for the same reason (ie median) trucks cannot cross lane to access building, they cannot cross lane to do anything else either.

@Elesbaan70
Copy link
Contributor Author

@aubergine10 @Elesbaan70 All the issues you raised are all interesting and valid points. But none of them are serious enough to abandon this task all together.

Who, me? I'm actually in favor of this. I just want to pick it apart and make sure we aren't risking false positives.

I think detecting medians using elevated None lanes is an easy yet effective phase 1 for this issue

I don't even think you have to limit it to None lanes. but the elevation difference needs to fall within a range (even for None) to avoid false positives on lanes that are above the roadway and don't divide it. (see image below)

it probably would take me less time to write the code than to discuss it!!!!

In any case, this isn't really very urgent for me, since I'm gonna have to account for crossing oncoming lanes regardless of the presence of a median. 🤷‍♂️

Lanes above roadway that don't divide the road:

image

@krzychu124
Copy link
Member

I always thought the flag was about "can deliver to building on other side of road" / "can leave building and go directly to other side of road to start journey".

This and only this. There no other use of m_canCrossLanes in the whole game codebase (that's why vehicles can cross median when building ahead is on fire). It's used when StartPathfind is trying to find a position on lane for forward and backward starting/ending point so pathfinding will ignore all lanes going backward direction (those further away aka positionB) on the segment closest to the target building.

@originalfoo
Copy link
Member

All the issues you raised are all interesting and valid points. But none of them are serious enough to abandon this task all together.

I'd hate to see th is abandoned. If we can get even a fraction of it working it will be huge improvement for creators and users alike.

I think detecting medians using elevated None lanes is an easy yet effective phase 1 for this issue

Assuming that there are no vehicle lanes overlapping them to a sufficient degree. But yes, if we can get this it will be awesome.

@Elesbaan70
Copy link
Contributor Author

@kianzarrin I think we should hold off on implementing this until displaced lanes are done. The two features have a lot of overlap, since we're basically talking about grouping lanes for lane transition rules, and we don't want a repeat of the LaneConnectionManager mix-up. ;-)

It might even turn out that combining the two features makes sense, but I won't know that until I get into it.

@Elesbaan70
Copy link
Contributor Author

I am closing this issue because I've formally defined an enhancement to achieve what it was after. #1528

@originalfoo originalfoo added this to the Not Applicable milestone Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new distinct feature LANE ROUTING Feature: Lane arrows / connectors PATHFINDER Pathfinding tweaks or issues triage Awaiting issue categorisation
Projects
None yet
Development

No branches or pull requests

4 participants