Author Topic: Update to Maintenance for Ships in Shipyards  (Read 1362 times)

0 Members and 1 Guest are viewing this topic.

Offline SteveAlt (OP)

  • Global Moderator
  • Rear Admiral
  • *****
  • Posts: 820
  • Thanked: 8 times
Update to Maintenance for Ships in Shipyards
« on: May 06, 2009, 10:45:09 AM »
Several people have reported a bug causing ships in shipyards to gain time on their clocks. I was making changes to the ways overhauls worked for ships in shipyards and I accidently tracked down the problem. Essentially, the v4.0 code prevents ships in shipyards having maintenance failures by excluding them entirely from the maintenance checks section of the code. Therefore I couldn't see how time was advancing on their clocks. However, after going through the code I realised I was working under a false assumption. Ships don't actually gain time on their clocks. Instead they have a LastOverhaul time and that is compared to the current Game Time to determine their 'Overhaul Clock'. Maintenance Facilities increase the LastOverhaul time by an amount equal to the size of the 5-day increment. If a ship is in overhaul it advances the LastOverhaul time by 3x the increment size for warships and 8x for non-combatants. For v4.1 there are only military ships (as most non-combatants are now freighters and don't require maintenance) and they gain 4x the increment size when in overhaul. Anyway, back to the bug. So because ships in Shipyards are excluded from this section of code, their LastOverhaul times don't change and therefore the advance of game time effectively increases the time on their 'Overhaul Clock'.

I have made some changes to the way maintenance works for ships in shipyards, which should fix the above problem and make it the whole process a little more intelligent. When a ship is given a repair or refit task, it is automatically put into an overhaul state as well if sufficient maintenance facilities exist at that population. This means (in v4.1) that a ship will be rewinding its clock at 4x speed while it is in that shipyard. Longer shipyard tasks will mean more overhaul time. When the shipyard task is complete, the ship reverts back to a non-overhaul state. If the overhaul is completed before the shipyard task, the ship reverts to a non-overhaul state at that point. For those ships in shipyards in a non-overhaul state, either because they have completed an overhaul or because insufficient maintenance facilities exist at that population to start an overhaul, the LastOverhaul time will be advanced at the same rate as Game Time so that time on the 'Overhaul Clock' will not increase.

In addition, as a result of a very good suggestion by IanD, when a ship completes a repair, the remaining time on the 'Overhaul Clock' will be reduced equal to the percentage of new non-armour systems repaired in terms of cost. So if you repair twenty percent (by cost) of a ship's systems with new ones, the 'Overhaul Clock' will be reduced by twenty percent. A event will be created showing the reduction.

For refits, the cost of new systems will be treated as the repair cost above. Note that the cost of new systems is not the same as the total refit cost as that includes additional costs beyond that for the actual systems (+25% for refit work and 5x size difference). You can already get a breakdown of refit costs by clicking the refit details button on the Shipyard tab of the Economics window.

Steve
 

Offline Beersatron

  • Gold Supporter
  • Rear Admiral
  • *****
  • Posts: 996
  • Thanked: 7 times
  • Gold Supporter Gold Supporter : Support the forums with a Gold subscription
Re: Update to Maintenance for Ships in Shipyards
« Reply #1 on: May 06, 2009, 12:20:57 PM »
Quote from: "SteveAlt"

....

In addition, as a result of a very good suggestion by IanD, when a ship completes a repair, the remaining time on the 'Overhaul Clock' will be reduced equal to the percentage of new non-armour systems repaired in terms of cost. So if you repair twenty percent (by cost) of a ship's systems with new ones, the 'Overhaul Clock' will be reduced by twenty percent. A event will be created showing the reduction.

...


Is this for repairs in space using damage control or just repairs at a Shipyard?

Everything sounds good to me, especially the slightly faster overhaul speed! :)
 

Offline sloanjh

  • Global Moderator
  • Admiral of the Fleet
  • *****
  • Posts: 2805
  • Thanked: 112 times
  • 2020 Supporter 2020 Supporter : Donate for 2020
    2021 Supporter 2021 Supporter : Donate for 2021
Re: Update to Maintenance for Ships in Shipyards
« Reply #2 on: May 06, 2009, 02:25:11 PM »
Quote from: "SteveAlt"
This means (in v4.1) that a ship will be rewinding its clock at 4x speed while it is in that shipyard.

Just so I understand, from the mechanism you described (timestamp advances at 4x real time) it will take 4 months, not 3 months, to unwind a year from the clock.  Is this what's intended?  If not, then the timestamp should advance at 5x real time (4x for unwinding, and 1x to keep up with the inexorable march of time :-) ).

John
 

Offline SteveAlt (OP)

  • Global Moderator
  • Rear Admiral
  • *****
  • Posts: 820
  • Thanked: 8 times
Re: Update to Maintenance for Ships in Shipyards
« Reply #3 on: May 06, 2009, 02:37:18 PM »
Quote from: "Beersatron"
Quote from: "SteveAlt"
In addition, as a result of a very good suggestion by IanD, when a ship completes a repair, the remaining time on the 'Overhaul Clock' will be reduced equal to the percentage of new non-armour systems repaired in terms of cost. So if you repair twenty percent (by cost) of a ship's systems with new ones, the 'Overhaul Clock' will be reduced by twenty percent. A event will be created showing the reduction.
Is this for repairs in space using damage control or just repairs at a Shipyard?

Everything sounds good to me, especially the slightly faster overhaul speed! :)
Its for actual repair tasks in shipyards rather than damage control.

Steve
 

Offline SteveAlt (OP)

  • Global Moderator
  • Rear Admiral
  • *****
  • Posts: 820
  • Thanked: 8 times
Re: Update to Maintenance for Ships in Shipyards
« Reply #4 on: May 06, 2009, 02:52:28 PM »
Quote from: "sloanjh"
Quote from: "SteveAlt"
This means (in v4.1) that a ship will be rewinding its clock at 4x speed while it is in that shipyard.

Just so I understand, from the mechanism you described (timestamp advances at 4x real time) it will take 4 months, not 3 months, to unwind a year from the clock.  Is this what's intended?  If not, then the timestamp should advance at 5x real time (4x for unwinding, and 1x to keep up with the inexorable march of time :)

Steve