increased aircraft breakdown rate based on travelled tiles patch

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

increased aircraft breakdown rate based on travelled tiles patch

Post by xarick »

This patch adds an expert game setting which increases the chances of an aircraft to breakdown every passing day after travelling a user defined number of tiles since last takeoff, ranging from 1 to 65535. If it's set to 0, the feature is disabled. Requires breakdowns being enabled, and it's only kicking in if the aircraft hasn't broken down yet.

Additionally, aircraft have a new property which allows them to keep track of their currently travelled distance by the means of a counter. Each time an aircraft moves from a tile to another, the count is increased by 1. The maximum limit of this counter is 65535, which is equivalent to saying that it has already changed its tile position 65535 times.

- Savegames before this patch will treat this game setting as disabled.
- Aircraft from savegames before this patch don't have the feature to keep track of distance travelled. This patch treats them as having travelled 0 tiles.
- Default value of this setting is 500 tiles. 0 disables it. It is increased or decreased in steps of 15 tiles when pressing the arrows.

download latest version (v4) here: viewtopic.php?f=33&t=76044&p=1193342#p1193342
v4
- Gradually slows down aircraft speed on breakdown, towards the reduced speed, instead of instantly transitioning to that speed.
- Improved breakdown checking to be more thorough.


v3
- Added "Distance flown", shown in aircraft details window. It can be shown up as red when the feature is enabled, breakdowns are enabled and the current value is above the user-defined limit.
- The counting no longer stop when the aircraft breaks down, to accomodate for the Distance flown feature.
- Improved the counter's different phases to become more precise: whenever it resets to 0, whenever it starts counting, and whenever it stops counting, for both airplanes and helicopters.
- Removed an unnecessary include.


Screenshot valid for v4, v3:
Image

Screenshot valid for v1:
Image
[+] Spoiler
older versions (v2, v1): v2
- fixed a typo in a string text
Last edited by xarick on 07 Nov 2017 14:02, edited 8 times in total.
Formerly known as Samu
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: increased aircraft breakdown rate based on travelled tiles patch

Post by Pyoro »

As first impression, I think the mix between days and distance is a bit odd. I'd stick with "x distance for the effect to kick in, and for every further y distance the effect increases", instead of using first distance, and then time.
User avatar
burty
Transport Coordinator
Transport Coordinator
Posts: 326
Joined: 16 Jun 2006 17:18
Location: Somwhere near a computer

Re: increased aircraft breakdown rate based on travelled tiles patch

Post by burty »

I would go by number of takeoffs/landings as there is more stress but on aircraft the more times they cycle than #hours or distance travelled.


Sent from my iPhone using Tapatalk
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: increased aircraft breakdown rate based on travelled tiles patch

Post by xarick »

Pyoro wrote:As first impression, I think the mix between days and distance is a bit odd. I'd stick with "x distance for the effect to kick in, and for every further y distance the effect increases", instead of using first distance, and then time.
What it's doing in detail is:

A) When the aircraft takesoff, it begins counting the distance travelled during flight, starting from 0
1 - as far as I could understand, this is being checked twice per tick
2 - if the aircraft tile coordinates change, the counter is increased by 1

B) If the aircraft is not broken down yet, the counter reaches the user defined 'x' distance. There are two parts before the breakdown actually happens.
1 - the first part is checked daily, and reliability and probability are dealt with
1.1 - it reduces reliability of the vehicle
1.2.1 - normally, it randomly decides if the chances to breakdown are increased or not...
1.2.2 - ... but since it has already reached the 'x' distance, these chances are always increased, instead of randomly deciding
1.3 - it tests both chance and reliability to actually signal the vehicle to breakdown, if it passes the test
2 - the second part is checked tickly, and deals with the breakdown signaling, which is coupled with a countdown to breakdown the vehicle
2.1 - checks if the vehicle was signalled to breakdown
2.2 - if it was, then it starts a countdown starting at a randomly generated value
2.3 - this countdown is decreased every tick, until it reaches 0, which is when the vehicle really breaks down

C) For the rest of the flight, the aircraft is broken down, until it lands
1 - once it lands, the counter is reseted back to 0 again
2 - the aircraft clears breakdown mode
Formerly known as Samu
xarick
Transport Coordinator
Transport Coordinator
Posts: 336
Joined: 26 Feb 2015 00:52

Re: increased aircraft breakdown rate based on travelled tiles patch

Post by xarick »

v4
- Gradually slows down aircraft speed on breakdown, towards the reduced speed, instead of instantly transitioning to that speed.
- Improved breakdown checking to be more thorough.

older version (v3)
[+] Spoiler
v3
- Added "Distance flown", shown in aircraft details window. It can be shown up as red when the feature is enabled, breakdowns are enabled and the current value is above the user-defined limit.
- The counting no longer stop when the aircraft breaks down, to accomodate for the Distance flown feature.
- Improved the counter's different phases to become more precise: whenever it resets to 0, whenever it starts counting, and whenever it stops counting, for both airplanes and helicopters.
- Removed an unnecessary include.
Formerly known as Samu
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Argus, Google [Bot] and 6 guests