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

Add increasing turn penalties for increasingly-sharp turns [Suggestion] #999

Open
me22 opened this issue Sep 2, 2020 · 0 comments
Open
Labels
feature A new distinct feature triage Awaiting issue categorisation

Comments

@me22
Copy link

me22 commented Sep 2, 2020

Describe your idea

I have a few goals with this:

  • Humans would generally rather take 1 turn than 3, even if it's slightly quicker to take 3. (They'll take 3 if it avoids traffic, but the existing extra costs for high-traffic segments will handle that fine.)
  • A variety of useful road arrangements add very sharp turns that are technically possible (screenshot below for what I mean) but generally not what anyone wants. (It's great that the lane connectors or arrows tools can fix this, but it would be nice if the pathfinder just discouraged them strongly to begin with.)
  • It's normal for GPSs to do something like this, to avoid overloading the driver with directions for minimal value. (So having this would make the traffic routes tool show something that looks more like the routes you'd see on a maps app.)
  • In more complicated intersections (than just right-angle ones) it would be nice to encourage vehicles to take more gentle turns instead of sharper ones.
  • This can also help keep diamond interchanges on a curve from sometimes looking like taking the ramp is better than staying on the highway (particularly if one uses 2-lane highways as ramps) as it would add a bit of extra penalty for the exit.

Screenshots?

What I mean by sharp left turns:
image

Notes or questions?

So as concrete a starting point, I'd propose something like this:

ϴ (°) cos ϴ = â·b̂ penalty notes
0 to 30 1 to 0.866 zero the game shows a straight arrow in this range, so treat it like no turn (that also keeps from penalizing non-corner nodes)
30 to 70 0.866 to 0.342 low this covers the shallowest reasonable turns off a road that continues straight (like a highway exit)
70 to 110 0.342 to −0.342 normal most would hit this, particularly ⦜ turns
110 to 150 −0.342 to −0.866 high not always bad, but fine to penalize more strongly
150 to 180 −0.866 to −1 blocked this is only possible with anarchy, and is usually already blocked by the acuteTurningAngle check

(I don't know what low/normal/high would mean exactly; I figured I'd start with something like low*2 = normal = high/2.)

As a picture, to help visualize the 5 segments:
image

If this sounds plausible I'd be happy to give implementing it a shot -- looks like it'd need to happen in ProcessItemCosts? Perhaps always calculate the dirDotProd, default the (max)turningAngle to 0.866f instead of 1f to handle the blocked section, then add a bit more to duration based on the direction change...

@me22 me22 added feature A new distinct feature triage Awaiting issue categorisation labels Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new distinct feature triage Awaiting issue categorisation
Projects
None yet
Development

No branches or pull requests

1 participant