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

Speed limit gradietns and buffs/nerfs #668

Open
originalfoo opened this issue Feb 7, 2020 · 0 comments
Open

Speed limit gradietns and buffs/nerfs #668

originalfoo opened this issue Feb 7, 2020 · 0 comments
Labels
enhancement Improve existing feature feature A new distinct feature Overlays Overlays, data vis, etc. SPEED LIMITS Feature: Speed limits UI User interface updates

Comments

@originalfoo
Copy link
Member

originalfoo commented Feb 7, 2020

I spend ages fiddling with speed limits, only to have to redo them over and over as I keep altering my roads. It's also extremely time-consuming doing speed gradients due to all the back-and-fourth between signs on the map and the speeds palette.

Speed gradient (road) - modified click

Example: Slip road between motorway and roundabout. The motorway is 70 MPH, the roundabout is 30 MPH.

As cars approach the roundabout, I want them slowing towards 30 MPH.

Depending on slip road length (sometimes they are quite long) I don't want a smooth gradient from one end to the other, so I might have something like:

R = Roundabout | M = Motorway | S = Slip road | (#) = Speed

R(30) S(30) S(40) S(50) S(60) S(70) S(70) S(70) S(70) M(70)

or (30mph for last two segments)...

R(30) S(30) S(30) S(40) S(50) S(60) S(70) S(70) S(70) M(70)

To make it generic (not just slip roads):

  • User chooses segment on chosen road that will get the gradient:
    • Work out which junction is nearest that segment
    • Segments between that junction and mouse get set to target speed of junction
    • Remaining segments (to further away junction) get speed gradient towards its target speed
      • One segment at a time, increments of 10 (or whatever is most applicalbe to MPH vs. km/h)
      • Once target speed is reached, remaining segments stay at that speed
  • Target speed of junction:
    • Take lowest (or average?) speed of all roads at junction, excluding the chosen road
    • That's the target speed for that junction

With this approach I can easily create speed gradient between two junctions, and I can choose where the gradient happens.

Possible key modifier: Alt+Shift+Click for "route gradient" (it compliments existing Shift = "apply to route" in speed limits tool)

A variant could be Alt+Click (localised gradient) where user would create a gradient anywhere. For example, road is 50 MPH along many segments. I choose a differnet speed (faster or slower) and Alt+Click segment in that road and it sets that segment to chosen speed and then gradiates speed in both directions to whatever the road speed is.

Speed gradient (lanes) - mod option

Imagine motorway with 4 lanes. I set speed of motorway, both directions, to 70 MPH. I want outermost lane to be 65, middle lanes to be 70, innermost lane to be 75. So a Modifier + Click could take the current average speed of the lanes on each side and then apply the lane gradient to both directions (or something like that).

This could just be a mod option that applies only to highways (it doesn't make much sense on city roads).

Speed gradient (slope) - mod option

I have some very steep inclines/declines where roads are going up or down a mountain and I often create slightly increasing speed on the way down, and decreasing speed on the way up. Not too much as drivers would just break/accelerate more, but just enough to make it look like the slope is having an effect on the vehicles.

Would be great to have a mod option that adjusts vehicles speeds on slopes:

  • Vehicles going up steep slope slow a little (below assigned speed limit)
    • Lorries and some industry vehicles should ideally slow even more
  • Vehicles going down steep slopes should speed up a little (above assigned speed limit)
    • Lorries in particular should be hitting the breaks more often (flicker their red break lights?)

Speed gradient (sharp bends) - mod option

I generally play on mountain maps so end up with lots of roads snaking down mountains or through valleys or along contour lines or besides rivers.

I like to have the sharp bend slower speed than the rest of the road, with the amount of slow-down depending on how sharp the bend is. And then a speed gradient on the segments either side of the bend. Aside from just making traffic behave more realistically, it also prevents emergency vehicles (when responding to emergency) from flying off the road.

Would be great to have a mod option that detects sharp bends and applies speed gradients to them automatically.

Regarding mod options

The user would set their speeds for the roads in usual manner, and the mod option(s) as applicable would buff/nerf those speeds.

There are already some features for altering speeds, namely:

  • Vanilla game increases speed of well maintained roads
  • TM:PE reduces speed of poorly maintained roads
  • TM:PE (or vanilla game?) reduces speed for certain weather conditions (rain and snow, aka "wetness")

I assume they are designed to just apply a buff/nerf to speeds of all roads/rails/etc on map, so not quite same as what the new mod options would do but maybe good place to look to determine where such buffs/nerfs can be introduced in to code.

For new mod options, doing calculations per frame per vehicle is going to be a laggy mess. So it would need to do those calcs whenever user places/changes roads or alters speed limits and cache the buffed/nerfed value alongside the users chosen value. Then the vehicle AIs would just use the buffed/nerfed value as basis for the speed of the segment/lane.

To keep data serialisation fast and small, only user speeds would be persisted in save game; the buffed/nerfed speed would be calcuated on game load depending on mod options.

Also, if mod options changed, the buffed/nerfed speeds would obviously need updating.

Related stuff

If we get good infrastructure for buffing/nerfing speeds, there's probably some other ideas we could revisit:

@originalfoo originalfoo added enhancement Improve existing feature feature A new distinct feature UI User interface updates SPEED LIMITS Feature: Speed limits Overlays Overlays, data vis, etc. labels Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing feature feature A new distinct feature Overlays Overlays, data vis, etc. SPEED LIMITS Feature: Speed limits UI User interface updates
Projects
None yet
Development

No branches or pull requests

1 participant