Okay, new day, new rant. Today's topic is

Defense, Combat Hitpoints, Cargo Capacity and the Hitpoint Cap. Quite a lot of material ...

Here's the problem setup. I am designing a unit, it has whatever stats and specials I like- except, Defense is 0. Now, I'd like to spend some more points on this unit and I'm contemplating a choice: either I spend more points to increase Defense, or more points to increase Hits.

What exactly am I buying, if I choose either of these?If I buy Hits, I am buying: primarily, combat hitpoints (I increase the Attack that an enemy needs to croak this unit); secondarily, I increase Cargo capacity and the ability of this unit to "gain" combat hitpoints through stacking.

If I buy Defense, I am buying: primarily, combat hitpoints; secondarily, I increase the unit's ability to "offer" combat hitpoints through stacking.

First, let's look into the offering-receiving of combat hitpoints through stacking. If I have two units, separately they will have a certain sum of combat hitpoints

Unit A with H1 hits and D1 defense, unit B with H2 hits and D2 defense, have, if kept separate,

H1*8/(8-D1) + H2*8/(8-D2) combat hitpoints. That's the damage the enemy needs to inflict to kill them both.

while stacked, something that may well be a different amount

(H1 + H2)*8/(8 - (D1 + D2)/2)

A similar analysis goes for stacking more units together, but the effect is less dramatic the more units you add. The significant changes happen when stacking two units, so that's what I'm looking at. Already, it's a very bizzare function, I assure you. One unit, the one with less defense, will "gain" combat hitpoints; the higher defense unit "loses" a few. Will the trade be fair?

Here's a case of weirdness. Suppose I have a unit with 100 Hits, 0 Defense. And then, I have one with 50 Hits, and X defense. Should I stack? Should I leave them separate? If X is 0, no difference. Stacking results in a gain of combat hitpoints if X is 1, 2 or 3. If X is 4, then

it doesn't matter: either together or apart, a 100H 0D and 50H 4D unit have 200 combat hitpoints. If X is 5, I actually

lose combat hitpoints. Paradox?

You'll usually want to stack the two units, regardless, since the 100H unit always benefits from the exchange and gets harder to kill. However, if the enemy has enough firepower to kill the two units if stacked, keeping them apart may offer you better chances of survival.

Anyway, I've done some numerical testing and, for valid Defense values between 0 and 5, here are some conclusions:

- if you use a unit with high defense to beef up a stack made of that unit and another unit with 0 defense, then the 0 defense unit needs to have at least 15% hitpoints than the high defense unit. (And this bonus would be merely theoretical; a 115H 0D unit and a 100H 1D unit stacked gain 0.05 combat hitpoints; stacking a 115H 0D unit with a 100H xD results in a combat hitpoint

loss for any x from 1 to 5!)

- as expected, the more hits the low-defense unit has, the better it stands to gain from stacking.

- I tried stacking a "large" unit with a 5H, x D unit, and see how much combat hits I gain.

Consistently, the best gains happen for "large" H 2D stacked with 5H 5D. So if you want large hit gains,

stack a large unit that has Defense 2 (or 3, or 0, in this order) with a 5H 5D unit.

- If I stack a 20H 2D and a 5H 5D unit, I gain 4.44 combat hits; for 30H 2D and 5H 5D, I gain 8.89; for 40H 2D and 5H 5D, I gain 13.33; for 100H 2D and 5H 5D, I gain ~40 combat hits, and for 1000H 2D and 5H 5D, I gain ~440 combat hits. What happens is that the 5H unit "loses" about 5 combat hits (alone, it has ~13.6; in the stack, it has a bit less than 9); the large unit gains Hits*(8/(6) - 8/(4.5)): so, proportional to the number of its own hits, and if this number of hits is large, it dominates the number of hits gained by the stack.

This suggests one idea of where to put a unit cap: make it so that the cheapest highest defense unit cannot offer a combat hitpoint gain more than -> and here you're free to tune.

It also suggests something else. See, when I buy Hits or Defense, I need to make another investment also in order to access the secondary effects. If I want to use a unit as a carrier, I need to buy the cargo; if I want to use a unit to gain combat hitpoints by stacking, I need to buy a larger unit to stack it with. However, cargo will be cheaper than a unit that, if stacked, will result in a beefier stack.

So when comparing the cost of increasing defense, and increasing hits, I think I can ignore the hitpoint gain by stacking effect, since it's costlier to actually manifest significantly.

So then, to return. I buy Defense for my unit, I'm increasing its combat hits. Here's by how much:

0D: no increase; 1D: 8/7, or about 14% increase; 2D: +33%; 3D: +60%; 4D: +100%; 5D: +166%.

Notice that the combat hitpoint increase is not linear in Defense. In fact, the best way to replicate this behaviour in the cost formulas we have now is to replace the Defense factor by 8/(8-Defense) (optionally, multiplied by some constant). So my formula for example should become:

Cost of the unit = Hits*Move*0.5 + (8/(8 - Defense))*some constant*0.5*Hits^(2/3) + Attack + Specials

Ok, now let's do one more thing and call it a rant for today.

Let's say I beef up a unit's defense by 1. This gains me more combat hitpoints, let's say 4. Then I change my mind; I undo the change, and instead want to buy 4 Hits.

They should be more expensive (and this will put a limit on how big that constant in the formula just above can be). That's because that cost for those 4 Hits should cover the fact that I'm beefing my unit's combat hitpoints by 4, but also giving it the ability to carry 2Hits extra of cargo.

So, the difference between the cost I payed for the defense, and the cost I payed for the equivalent extra hits, is

the cost for cargo capacity. This cost, I think, should be move-sensitive (fast cargo is more valuable tactically), so this means that

in a cost formula, the Hits term must be multiplied by Move, and the Defense term must not contain Move at a power of 1 or more. (Check; our formulas obey this). Optionally, cargo can become more expensive the bulkier it gets; to ensure that this happens,

the Defense term should not contain Hits at a power of 1 or more (check; both our formulas obey this).

The big conclusion of today is then:

In a unit cost formula, the Defense term should be of the form (8/(8 - Defense))*some constant*(Hits^less than 1)*(Move^less than 1). The "some constant" must be chosen such that it is cheaper to increase a unit's combat hitpoints by increasing its Defense, than it is by increasing its Hits. (Also, the Hits term should include Move at a power of at least 1.)(In my formula, Move in the Defense term is at power 0. Move^0 = 1

)

The whole point of this is lost if you keep it a secret.