OpenTTD-patches icon indicating copy to clipboard operation
OpenTTD-patches copied to clipboard

[Suggest] Restrict realistic braking to stock railtypes

Open goodgerster opened this issue 3 years ago • 1 comments

Some NewGRFs (notably Wired and PIPE) create railtypes to which train physics should not apply. Wired in particular has a ‘train’ with a top speed of 3000 km/h, weight of 10 t, and power of 45 MW.

  • With realistic braking turned off, as far as I can tell, Wired trains accelerate to full speed almost immediately and, when visiting stations with orders to stop at the near end, will decelerate from full speed to 0 within one tick. This lets them provide Internet-like mail service, which is nice.
  • With realistic braking turned on, Wired trains accelerate to about 10% of their full speed (again almost immediately) and spend their entire journey coasting to an agonizing halt. This makes them pretty much worthless.

I’ve (tried to) read the code that computes braking force, and it looks to me like it’s equal to acceleration force in all cases, which (while not physically accurate) ought at least to produce a symmetric speed graph. It seems maglevs get special treatment to correct what I assume is similarly incongruous behaviour from them. So I’m not sure what’s going on with this.

Either way, it would be good if Wired/PIPE/etc were not subject to realistic braking. I think the easiest way to do that is to add a condition to apply realistic braking only if GetAccelerationType returns 2 or less.

Thanks as always. :)

goodgerster avatar Apr 15 '21 11:04 goodgerster

I think the easiest way to do that is to add a condition to apply realistic braking only if GetAccelerationType returns 2 or less

Unfortunately the only valid values are 0, 1, and 2. There aren't any extra acceleration types. Wired and PIPE appear to use type 2 (maglev).

I’ve (tried to) read the code that computes braking force, and it looks to me like it’s equal to acceleration force in all cases, which (while not physically accurate) ought at least to produce a symmetric speed graph. It seems maglevs get special treatment to correct what I assume is similarly incongruous behaviour from them. So I’m not sure what’s going on with this.

Tractive forces and acceleration are calculated in a simpler way for maglevs than the other two acceleration types, so the deceleration code matches that.

Deceleration is currently capped at an acceleration-type specific value. Acceleration isn't currently capped. There is room for improvement here. Mostly I've been focused on the other end of the scale with ordinary rail slow/heavy freight and passenger trains. Even without any capping, the speed graph is not symmetric because drag forces (part of which are proportional to v^2) have a large impact at higher speeds.

Either way, it would be good if Wired/PIPE/etc were not subject to realistic braking

I've added a per-rail type flag to disable realistic braking physics for trains of that type. For now I've set it by default for the wire and pipe rail types.

JGRennison avatar Apr 15 '21 19:04 JGRennison