CitiesSkylinesMods / TMPE

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

Pedestrians ignore traffic lights if road only has pedestrian lane on one side #1207

Open originalfoo opened 3 years ago

originalfoo commented 3 years ago

Describe the problem

Steam used Elesbaan noted:

I would like to see this mod include a fix for an issue with pedestrian traffic.

If a road only has a pedestrian lane on one side, pedestrians at intersections ignore traffic lights when crossing the road to access that lane. This CSL's default behavior, and it would be nice if TM:PE could fix it. I have created road assets that really should only allow pedestrian traffic on one side, but I could not configure them that way because of this limitation in CSL's traffic AI.

Steps to reproduce

I've asked user for links to assets which exhibit the problem.

Log files

n/a

Savegame?

I've asked user to provide a savegame.

Screenshots?

n/a

krzychu124 commented 3 years ago

Pedestrian crossing detection for segments with pavement on one side is not supported in our PathFinding (nor in vanilla), might be related to #786

Elesbaan70 commented 2 years ago

Here is an asset that reproduces the problem: https://steamcommunity.com/sharedfiles/filedetails/?id=2668761312

a small-ish savegame that uses it: https://steamcommunity.com/sharedfiles/filedetails/?id=2668762129

a video of it happening: https://www.youtube.com/watch?v=lJDRIjEk458

Elesbaan70 commented 2 years ago

In my limited testing, pedestrians seem to mostly do what I expect them to when there is only a pedestrian lane on one side. I just want them to stop jaywalking. ;-)

Elesbaan70 commented 2 years ago

On a hunch, I placed my test road in a developed area to see what would happen. As I suspected, pedestrians follow their designated lane to their destination, then just walk right across the street. Maybe the logic that makes this possible needs to check and make sure it's not happening at an intersection.

Elesbaan70 commented 2 years ago

To put it another way, only allow this uncontrolled crossing on segments. On nodes, follow the normal rules for crossing the street.

krzychu124 commented 2 years ago

To put it another way, only allow this uncontrolled crossing on segments

What do you mean? It's impossible for pedestrian to cross road/segment without a node. pedestrian crossing are always created on the node, there is no exception from that rule.

Elesbaan70 commented 2 years ago

there is no exception from that rule.

Apparently there is:

https://youtu.be/57zW6VazONc

originalfoo commented 2 years ago

Is there a node at the location when they were crossing? IIRC pedestrians can cross at bend nodes as well as junction nodes.

Elesbaan70 commented 2 years ago

The nearest nodes are the highlighted rectangles on the left and right.

krzychu124 commented 2 years ago

OK, I know where is the problem. How they suppose to get to that building if road connected to is has pavement on one side? I'm pretty sure that pathfinding fall back to default behavior as it uses for pavement/bike paths - they don't need to be connected and cim selects the shortest gap between two lanes, which in this case means crossing the segment because continuing the walk to the node would be pointless - there is no pavement path on the other side anyways (that variant will have worse overall pathfinding score).

Elesbaan70 commented 2 years ago

Yes, this was all my conclusion as well, minus the implementation details that I'm not familiar with.

So what if the logic that handles this is also in control when they cross at an intersection? That's my theory. But since I don't actually know how the code works..... 🤷‍♂️

Elesbaan70 commented 2 years ago

Another interesting behavior that might be related is that when the pedestrian lane on one side ends, forcing pedestrians to cross to the other side, their movement suggests to me that it's being treated like a lane change rather than a street crossing.

https://youtu.be/r7YbRYxOBrk

But when a cross street is added at the node, newly spawned pedestrians cross at the crosswalk as expected (still ignoring the light).