Repair Cost Formula. Do I have it Correct?
Moderators: firepowerjohan, rkr1958, Happycat, Slitherine Core
Repair Cost Formula. Do I have it Correct?
Repair_Cost = int(0.06 * Unit_Cost * Number_Steps_Repaired)
In other words, is the repair cost equal to 60% of the cost of the unit times the number of steps repaired divided by ten, rounded down?
In other words, is the repair cost equal to 60% of the cost of the unit times the number of steps repaired divided by ten, rounded down?
-
firepowerjohan
- Brigadier-General - 8.8 cm Pak 43/41

- Posts: 1878
- Joined: Mon May 22, 2006 7:58 pm
- Contact:
Correct. Manpower is 100% though as should be.
Johan Persson - Firepower Entertainment
Lead Developer of CEAW, CNAW and World Empires Live (http://www.worldempireslive.com)
Lead Developer of CEAW, CNAW and World Empires Live (http://www.worldempireslive.com)
-
Peter Stauffenberg
- General - Carrier

- Posts: 4745
- Joined: Sun Jul 08, 2007 4:13 pm
- Location: Oslo, Norway
It seems the game keep track of fractions regarding repairs, upgrades etc. Let's say you repair 4 motorized steps.
The formula is 0.6 * 45 * 4 / 10 = 10.8 rounded down to 10.
If you now want to repair 3 steps on a corps you will have the following formula.
0.6 * 35 * 3 / 10 = 6.3
Now you should pay 6 PP's, but you end up paying 7 PP's because the accumulated cost is: 6.3 + 0.8 (fractions from other repair) = 7.1.
The remaining 0.1 moves on to the next repair etc.
I think the same applies to manpower costs as well when you repair units.
I also believe the same applies to production (both PP and oil). E. g. you have the 7 PP Ruhr hex that's bombarded for 3 steps. It means the production will now be 7 * 7 / 10 = 4.9 PP's. I think the game calculates PP's with fraction so 4.9 PP's are added Germany's available production.
When all hexes are added the game rounds up or down and shows how many PP's you can spend. But internally all the fractions are kept so next turn you might actually get an "extra" PP due to rounding.
This is particularly important to remember as the Allies regarding strategic bombardment of oil production. Let's say you bombard the Scholven synth oil plant
in Germany (part of the BJR mod with 1 PP at max) and score 3 hits. The new
effective production is 1 * (10-3)/10 = 0.7.
Let's say Germany has a war effort of 130. That means the Scholven hex would at maximum yield 1 * 4 * 130 / 100 = 5.2 oil to the oil reserves.
But with 3 steps lost you will instead have the following formula:
1 * (10-3)/10 * 4 * 130 / 100 = 3.64
The game will still show 1 (full production) from the Scholven hex because you need to score an accumulated 5 hits or more to drop the number from 1 to 0 and change color from white to yellow, orange or red.
So the game uses fractions and it means a hit will ALWAYS be effective proportional to the damage you inflicted. You don't lose effect due to rounding up or down. This is particularly important to know because you would otherwise ignore strategic bombardment early in the game because you don't SEE any effect on the PP numbers on the map.
My example showed that Germany lost 1.56 oil on turn 1 from the 3 hit on the Scholven plant. On turn 2 Germany will lose 1.04 oil and on turn 3 will lose 0.52 oil. In total = 3.12 oil. So the strategic bombardment that seemed ineffective actually inflicted a loss of more than 3 oil to the German oil reserves.
The same applies to regular PP production.
So the key is that the game SHOWS integers, but calculates internally with all fractions and the fractions aren't forgotten due to rounding. So it evens out.
I think this is a good thing, but it can be frustrating if you produce on a very tight schedule. E. g. you micromanage it so you repair units knowing you have an infantry to repair that would cost 2 PP's and bring you to 0 PP's. Then you want to repair 5 steps on the front fighter that was mauled last turn. Then it's bad if keeping fractions meant the 1 step on the corps you wanted to repair actually costs 3 instead of 2 due to fractions being kept. So you ended up with -1 and can't repair the seriously depleted fighter. Next turn the enemy takes advantage of that and lure is to intercept and then sends another fighter to kill it at the airbase.
This doesn't happen very often, but it's smart of be aware of such "surprises" and make sure you always add +1 to the last unit you want to repair before reaching 0 PP's prior to actually making the repairs. If you had done that you would have seen the corps could actually cost 3 PP's and not repaired it and just repaired the fighter.
The formula is 0.6 * 45 * 4 / 10 = 10.8 rounded down to 10.
If you now want to repair 3 steps on a corps you will have the following formula.
0.6 * 35 * 3 / 10 = 6.3
Now you should pay 6 PP's, but you end up paying 7 PP's because the accumulated cost is: 6.3 + 0.8 (fractions from other repair) = 7.1.
The remaining 0.1 moves on to the next repair etc.
I think the same applies to manpower costs as well when you repair units.
I also believe the same applies to production (both PP and oil). E. g. you have the 7 PP Ruhr hex that's bombarded for 3 steps. It means the production will now be 7 * 7 / 10 = 4.9 PP's. I think the game calculates PP's with fraction so 4.9 PP's are added Germany's available production.
When all hexes are added the game rounds up or down and shows how many PP's you can spend. But internally all the fractions are kept so next turn you might actually get an "extra" PP due to rounding.
This is particularly important to remember as the Allies regarding strategic bombardment of oil production. Let's say you bombard the Scholven synth oil plant
in Germany (part of the BJR mod with 1 PP at max) and score 3 hits. The new
effective production is 1 * (10-3)/10 = 0.7.
Let's say Germany has a war effort of 130. That means the Scholven hex would at maximum yield 1 * 4 * 130 / 100 = 5.2 oil to the oil reserves.
But with 3 steps lost you will instead have the following formula:
1 * (10-3)/10 * 4 * 130 / 100 = 3.64
The game will still show 1 (full production) from the Scholven hex because you need to score an accumulated 5 hits or more to drop the number from 1 to 0 and change color from white to yellow, orange or red.
So the game uses fractions and it means a hit will ALWAYS be effective proportional to the damage you inflicted. You don't lose effect due to rounding up or down. This is particularly important to know because you would otherwise ignore strategic bombardment early in the game because you don't SEE any effect on the PP numbers on the map.
My example showed that Germany lost 1.56 oil on turn 1 from the 3 hit on the Scholven plant. On turn 2 Germany will lose 1.04 oil and on turn 3 will lose 0.52 oil. In total = 3.12 oil. So the strategic bombardment that seemed ineffective actually inflicted a loss of more than 3 oil to the German oil reserves.
The same applies to regular PP production.
So the key is that the game SHOWS integers, but calculates internally with all fractions and the fractions aren't forgotten due to rounding. So it evens out.
I think this is a good thing, but it can be frustrating if you produce on a very tight schedule. E. g. you micromanage it so you repair units knowing you have an infantry to repair that would cost 2 PP's and bring you to 0 PP's. Then you want to repair 5 steps on the front fighter that was mauled last turn. Then it's bad if keeping fractions meant the 1 step on the corps you wanted to repair actually costs 3 instead of 2 due to fractions being kept. So you ended up with -1 and can't repair the seriously depleted fighter. Next turn the enemy takes advantage of that and lure is to intercept and then sends another fighter to kill it at the airbase.
This doesn't happen very often, but it's smart of be aware of such "surprises" and make sure you always add +1 to the last unit you want to repair before reaching 0 PP's prior to actually making the repairs. If you had done that you would have seen the corps could actually cost 3 PP's and not repaired it and just repaired the fighter.
@Stauffenberg,
Thanks, I should have known you would know the answer to this in great detail.
I have a couple of follow up questions.
(1) Do fractions carry over to the next turn? For example, I repair 5 steps of an infantry corps. The cost is 10 PPs with 0.5 PPs left over. Would that 0.5 PPs carry over and be included in the first repair of next turn?
(2) Please bear with me on this while I set up my question. Suppose for example I have 19 PPs and an 8-step armor corps, 5-step infantry corps and 7-step fighter unit that I wish to repair. If I click on the repair icon and hover over these three units one at a time, without repairing anything, I'll see repair costs of 9 PPs for the armor (.06*80*2 = 9.6 rounded down), 10 PPs for the infantry (.06*35*5 = 10.5 rounded down) and 18 PPs for the fighter (.06*100*3 = 18.0). As you illustrated above if I ignore the fractions I could erroneously estimate that I could repair the armor first and the infantry second at a cost 19 PPs leaving me with 0. Then I could repair the fighter and this would leave me with -18 PPs. However, because the fractions are carried from repair to repair the 0.5 left over from the armor repair would be added to the 9.6 for the infantry repair, which would cost me 11 PPs (versus 10 PPs) and would leave me with -1. Thus, I'd be unable to repair the fighter. Now my question. After I repair the armor corps if I hover the repair icon over the infantry corps would it show a cost of 11 PPs, which would account for the fraction carryover, or a cost of PPs as it did originally?
Thanks, I should have known you would know the answer to this in great detail.
I have a couple of follow up questions.
(1) Do fractions carry over to the next turn? For example, I repair 5 steps of an infantry corps. The cost is 10 PPs with 0.5 PPs left over. Would that 0.5 PPs carry over and be included in the first repair of next turn?
(2) Please bear with me on this while I set up my question. Suppose for example I have 19 PPs and an 8-step armor corps, 5-step infantry corps and 7-step fighter unit that I wish to repair. If I click on the repair icon and hover over these three units one at a time, without repairing anything, I'll see repair costs of 9 PPs for the armor (.06*80*2 = 9.6 rounded down), 10 PPs for the infantry (.06*35*5 = 10.5 rounded down) and 18 PPs for the fighter (.06*100*3 = 18.0). As you illustrated above if I ignore the fractions I could erroneously estimate that I could repair the armor first and the infantry second at a cost 19 PPs leaving me with 0. Then I could repair the fighter and this would leave me with -18 PPs. However, because the fractions are carried from repair to repair the 0.5 left over from the armor repair would be added to the 9.6 for the infantry repair, which would cost me 11 PPs (versus 10 PPs) and would leave me with -1. Thus, I'd be unable to repair the fighter. Now my question. After I repair the armor corps if I hover the repair icon over the infantry corps would it show a cost of 11 PPs, which would account for the fraction carryover, or a cost of PPs as it did originally?
-
Peter Stauffenberg
- General - Carrier

- Posts: 4745
- Joined: Sun Jul 08, 2007 4:13 pm
- Location: Oslo, Norway
Here's an interesting conclusion to all this that just struck me. The repair cost per step is 6% of the unit cost. Thus, repairing a 1-step unit back to full strength cost 54% of what it would cost to build it from scratch. This is about half the cost of a new unit. So, it really pays to save a 1-step unit. On the other hand it's worth the extra effort and air losses to finish off 1-step units wherever you can.
Yes, Killing a Unit is twice better than just damaging one.rkr1958 wrote:Here's an interesting conclusion to all this that just struck me. The repair cost per step is 6% of the unit cost. Thus, repairing a 1-step unit back to full strength cost 54% of what it would cost to build it from scratch. This is about half the cost of a new unit. So, it really pays to save a 1-step unit. On the other hand it's worth the extra effort and air losses to finish off 1-step units wherever you can.
Yes. But what surprise me was that killing a unit was twice as good as depleting one down to 1-step. Or, that destroying a 1-step unit double the cost of "repairing" that unit back to 10-steps.julyderek wrote:Yes, Killing a Unit is twice better than just damaging one.rkr1958 wrote:Here's an interesting conclusion to all this that just struck me. The repair cost per step is 6% of the unit cost. Thus, repairing a 1-step unit back to full strength cost 54% of what it would cost to build it from scratch. This is about half the cost of a new unit. So, it really pays to save a 1-step unit. On the other hand it's worth the extra effort and air losses to finish off 1-step units wherever you can.


