JGRennison / OpenTTD-patches

OpenTTD - http://www.openttd.org/ - with additional patches
Other
553 stars 127 forks source link

[Bug]: Vehicles have reduced reliability, when the option "No vehicles expires after: year" is set. #646

Closed Nrgte closed 2 months ago

Nrgte commented 5 months ago

Version of OpenTTD

0.57.0

Expected result

I would expect vehicles to keep their original reliability the same way if the option: "vehicles never expire" was set.

Actual result

I'm using the Timberwolfs UK Road Vehicles Set 3.1.7 as example, but I assume this applies to all vehicles. Vehicles continue to lose max. reliability after the threshold date.

A couple examples (Year is set to 2020).

No vehicles expire after: 2005

Scania R Series: 53% max reliability Volvo FM9: 34% max reliability ERF E-Series: 44% max reliability

Vehicles Never expire:

Scania R Series: 77% max reliability Volvo FM9: 88% max reliability ERF E-Series: 85% max reliability

Steps to reproduce

Open a new game, set the start date into the far future when no more vehicles are introduced. For example 2150. Set "No vehicles expire after" to something between 1950 and 2005.

Open the console and enter the command: resetengines

All vehicles should have a very low max. reliability.

JGRennison commented 4 months ago

This is the intended behaviour. It is of little use if the setting is used so that vehicles no longer expire, but vehicles all end up with excessively low reliabilities.

Nrgte commented 4 months ago

It is of little use if the setting is used so that vehicles no longer expire, but vehicles all end up with excessively low reliabilities.

Sorry I'm confused as this is exactly what's going on. The way it's currently, makes the settings kinda useless because the vehicles would have such a low reliability that they'd constantly break down.

JGRennison commented 4 months ago

Ah sorry, I misunderstood what you were asking for.

Decreasing the reliability of vehicles is stopped after both the no vehicle expires after and no vehicles introduced after settings are reached. I should change the setting texts to explain this.

Nrgte commented 4 months ago

Ohh I see. I have "no vehicles introduced after" set to off. So if that is off and the "no vehicles expire after" is set, then the reliability seems to just go lower and lower.

Maybe I'm missing something, but I would find it more intuitive if the reliabilty just wouldn't decrease after the year of "no vehicles expire after" is set regardless of "no vehicles introduced after". Because in my case the NewGRF for road vehicles simply didn't have any new vehicles anymore to introduce and I though I can just set "no vehicles expire after" to keep the last few that have been introduced for eternity. But I'd prefer to still get new Maglev trains, so by setting "no vehicles introduced after" I wouldn't get those.

JGRennison commented 4 months ago

Thinking about it, perhaps it should just be one setting instead of two.

Nrgte commented 4 months ago

I would certainly appreciate that!

JGRennison commented 4 months ago

I've changed engine reliability decay to stop once the no vehicles expire after year is reached

Nrgte commented 4 months ago

Perfect, thank you very much!

Nrgte commented 4 months ago

Thanks for the fix! I just tested 0.58.1 and there is one little bug remaining. Vehicles introduced after "No vehicles expire after" still suffer from reduced reliability.

I've set the "No vehicles expire after" date to: 2000

If the vehicle is introduced before the year 2000, the reliability is correct:

https://i.imgur.com/WRwhpye.png

If the vehicle is introduced after the year 2000, the reliability is still very low:

https://i.imgur.com/SGFAvVh.png

JGRennison commented 4 months ago

Thanks for the fix! I just tested 0.58.1 and there is one little bug remaining. Vehicles introduced after "No vehicles expire after" still suffer from reduced reliability.

I've set the "No vehicles expire after" date to: 2000

If the vehicle is introduced before the year 2000, the reliability is correct:

https://i.imgur.com/WRwhpye.png

If the vehicle is introduced after the year 2000, the reliability is still very low:

https://i.imgur.com/SGFAvVh.png

If this is old/existing game you'll need to run reset_engines in the console to reset engine reliabilities. Otherwise vehicles introduced afterwards should have their initial reliability values.

Nrgte commented 4 months ago

Sorry, I forgot to mention, I did run resetengines. It's easily reproduceable in a new game too. Just set the "No vehicles expire after" to like 1950 and set the starting date to sometime later and all vehicles between 1950 and your starting date have reduced reliability. (At least with road vehicles)

JGRennison commented 4 months ago

Well yes, they'll have their initial reliability values, not their maximum ones.

Nrgte commented 4 months ago

Sorry I'm confused what you mean exaclty. Their initial reliability is not 36% like in the second screenshot. There is a clear reliability drop off between vehicles that have been introduced before the "No vehicles expire after" date and after that date.

Here's an example with the same vehicle. The only difference is the "No vehicles expire after" date.

This is with a new game:

2005: https://i.imgur.com/iT2NEwz.png

1995: https://i.imgur.com/xsoj7pY.png

I would expect the max. reliability to be 94% in both cases or am I missing something?

JGRennison commented 4 months ago

OK, I see what you are doing now. Probably best to combine the expiry/introduction stop year settings to avoid these issues with engine age and the reliability curves.

JGRennison commented 4 months ago

Unifying the settings doesn't seem necessary after all. Clamping the expiry to be not before the end of the engine's stage 1 duration should get the desired result.

Nrgte commented 4 months ago

What 's the "engine's stage 1 duration"? It's the first time I'm hearing about this.

JGRennison commented 4 months ago

It's the period of a year or so when the engine's reliability is rising to its maximum after the engine is first introduced, see here: https://wiki.openttd.org/en/Manual/Vehicles#maximum-reliability-ratings

Nrgte commented 4 months ago

Ahh I see what you mean, unfortunatelly, I can't move the expiry date further back because then I lack the vehicles used for transportation. The NewGRF I'm using introduces the last road vehicles around ~2005. But when I set the expiry date to 2005 all the trains, ships, aircraft and maglevs will have unusable reliability.

Ideally for me, when a vehicle is introduced after the expiry date it should keep it's starting max. reliability the same way all the vehicles do that got introduced before the expiry date. That would be my dream scenario. :)

JGRennison commented 4 months ago

That ought to be the case with the most recent commit

Nrgte commented 4 months ago

Ahh thank you very much!