# Ceasar's Mind

## Balancing Forces

Let me start this post with an email from my friend Vinh, as he explains the core concepts of force strength particularly well. This formula relates n amount of Unit 1, and n amount of Unit 2. I call it the “N vs N” formula where N obviously stands for the amount units.

Basically I started with this formula:

H1*D1 = H2*D2

But what would happen if there are 2 of Unit 2? Lets call these two units “Force 2.”

Intuition would tell me to multiply the attributes of Unit 1 by 2, in order to balance the two forces. However, if we just plug in numbers we can see that this doesn’t work out. Force 2 will still have an edge.

We can demonstrate this with a scenario.

H1*D1 = H2*D2

H1 = 100 H2 = 50
D1 = 1 D2 = 2

Since there are 2 of Unit 2, we multiply H1 by 2 to balance it.

H1 = 200 D1 = 1

1 Unit of Force 2 will die in 50 seconds, during which time Force 2 will deal a total of 200 damage and kill Force 1 completely! Both forces do not kill each other at the same time and therefore they are not balanced.

Obviously there is a trick involved here. We have to derive a formula mathematically. Intuition fails us here.

For both forces to be balanced, they must kill each other at the same time. Given a set amount of time (T), both forces must deal the same amount of damage.

Now if we set T equal to the time the unit is alive, which is his HP divided by the enemy’s damage and arbitrarily balance against an enemy whose damage is equal to 1 we can get a unit’s net damage.

D1 * T = D1 * (H1/1) = D1 * H1 = Net Damage

We can conclude that in order to be balanced, both forces must deal the same amount of Net Damage.

Force 2 has 2 Units, and therefore the total time the whole Force is alive is modeled differently.

1 Unit in the Force 2 will eventually die, within the time that he is alive the whole of Force 2 does 2 times his damage (since there are 2 units).

So, 2*(D2*H2) = Net Damage. However, this is not the whole story, since there is still one more unit alive. The damage that the solo unit does when he is alive also contributes to the Net Damage, therefore we must add his damage to the formula.

2*(D2*H2) + (D2*H2) = Net Damage.

Now we set the Net Damage of Unit 1 and 2 equal to get

H1*D1 = 2*(D2*H2) + (D2*H2).

I’ll shorten this letter by letting you clarify this with your own scenario.

Using mathematically induction I can prove this to be true if Force 2 is comprised of 3 units (And Force 1 still has 1 Unit).

H1*D1 = 3*(H2*D2) + 2*(H2*D2) + (H2*D2) (I can add the terms together)
H1*D1 = 6*(H2*D2)

Now what if it was a 2 vs 3 situation?

Using the pattern that I found, this would be my guess

2*(H1*D1) + (H1*D1) = 3(H2*D2) + 2*(H2*D2) + (H2*D2)
3*(H1*D1) = 6*(H2*D2)

Once again, I’ll leave you to make a scenario to clarify this formula. It should work out.

Take note that the amount of Units in both Forces is a relative term. It isn’t really the “amount” of units, its actually the ratio between their cost.

For 1 v 1 scenario, both Units cost the same amount. For 1 v 2, Unit 2 cost half as much as Unit 1. For 1 v 3, Unit 2 cost a third as much as Unit 1, etc. . .

So in fact, a 2 v 2, or a 3 v 3 scenario is modeled by the same formula as a 1 v 1 scenario, since their ratios will reduce to 1 : 1.

-Vinh

As we can see, the strength of a force grows exponentially with each additional unit. (Assuming units take up no space and don’t overkill their targets.) We can conclude then that a unit that costs twice as much as another unit should be exponentially more powerful. (The particular function for determining the strength of a unit given is price is given by the triangular numbers. Equally, the triangular numbers model the strength of a homogeneous force as it increases in size.) If we multiply a force’s strength by the raw strength of any unit in the force we can find the true strength of a force. I arbitrarily chose to call this value K. K is a useful concept because it allows us to determine the prices of units by simply solving the equation on the right for x, which represents the number of units in the force. Since the number of units is directly proportional to the price, simply divide another constant arbitrary value by x in order to obtain prices.

From actually putting this formula to use, I’ve found a few problems. First off, it’s very difficult to be precise. Not much of a problem, but a problem nonetheless. Secondly, the formula is strictly for pricing units in respect to combat. Since many attributes have utility along other dimensions, movement speed for example, the pricing is not exactly accurate. Finally, as mentioned before, collision size is not accounted for either. Theoretically, collision size should be directly proportional to cost, with larger units being bigger, but as that’s not always the case it can really break the numbers sometimes.

Nevertheless, the formula should be a decent start for any designer.