Theory

Count your army in minerals

Supply is the wrong unit.

Competitor Advanced

The short version

  • Supply counts bodies. Bodies are almost never the thing that is scarce.
  • Pick the currency that is actually short for you right now, and price both armies in it.
  • One table, of how well each of your units does against each of theirs, plus a decision about where your fire goes, gives you the result of a fight before you take it.
  • The model is not additive, and the exception is important: a medic kills nothing and changes everything.
  • Under fog, the enemy is not unknown. It is a bounded probability, and the bounds are the tech tree and the clock.

The situation

You are at forty minutes with six thousand gas banked and seven hundred minerals. They attack.

You lose the fight and you cannot work out why, because both armies were about a hundred and sixty supply and yours had more upgrades. The reason is that supply was never the relevant number. Gas was free to you at that point: you had more than you could spend. Minerals were the thing you were short of, and priced in minerals your army was much smaller than theirs.

The habit this guide teaches is choosing the denominator on purpose instead of letting the interface choose it for you.

Choose the currency

The same fight has three different answers depending on what you count in.

One zealot kills about three zerglings. In bodies that is an efficiency of three. In minerals it is a hundred minerals of zealot killing seventy five minerals of zergling, which is an efficiency of nought point seven five, and it means the zealot is losing. In gas it is undefined, because neither unit costs any.

One archon kills about six mutalisks. In bodies that is six. In gas it is three hundred of archon against six hundred of mutalisk, an efficiency of two, and the archon is winning comfortably.

None of those three numbers is more correct than the others. Which one is relevant depends entirely on which resource you are short of, and that changes several times in a long game. Early, minerals. In the middle, usually gas. Late, whichever one is not piled up in your bank.

A good player does this in their head without naming it. A newer player counts supply, which is the only one of the four currencies that never tells you anything about your economy.

The matrix

Now the general version, which is the one substantial model the course produced.

Write your army as a list of counts and theirs as another. Build a table where the entry in row i, column j is how effective your unit i is against their unit j, denominated in whatever currency you chose. Multiply, and you have a row of numbers: how much of each of their unit types your whole army can kill.

Then the step that makes it a model rather than a table: your army cannot fight everything at once. You have to decide what share of your fire goes at each of their unit types. Multiply the row by that decision, compare to what they actually have, and the sign of the result tells you who wins.

That last step, deciding where the fire goes, is the whole art. The table is fixed. The allocation is yours.

The working

Show the maths

The setup. Your army is a vector PP, theirs is QQ, and EijE_{ij} is how many of their unit jj one of your unit ii kills before dying, in the currency you picked. Then

(PTE)j=ipiEij\left(P^{\mathsf{T}} E\right)_j = \sum_i p_i\,E_{ij}
(1)
A row vector: what your whole army could kill of each of their types, if it fought only that type.

Appropriation. It cannot fight only one type, so let aa be the share of your army sent at each of their types, with jaj=1\sum_j a_j = 1. The expected kills are the component-wise product, explicitly not the dot product:

K=(PTE)aK = \left(P^{\mathsf{T}} E\right) \circ a
(2)

and you win the exchange where KjQjK_j \ge Q_j for every jj.

The class's worked example, which is the one calculation it carried all the way through. Ten zealots and one archon against twenty five zerglings and eight mutalisks. The table entries the lecture used, all of them prefaced with "let's say" and none of them measured: zealot against zergling 3, zealot against mutalisk 0, archon against zergling 8, archon against mutalisk 6.

PTE=(103+18,  100+16)=(38,  6)P^{\mathsf{T}} E = \big(10 \cdot 3 + 1 \cdot 8,\; 10 \cdot 0 + 1 \cdot 6\big) = (38,\; 6)
(3)

Set the appropriation to their own composition, twenty five and eight out of thirty three:

K=(382533,  6833)(28.8,  1.5)againstQ=(25,  8)K = \left(38 \cdot \tfrac{25}{33},\; 6 \cdot \tfrac{8}{33}\right) \approx (28.8,\; 1.5) \quad\text{against}\quad Q = (25,\; 8)
(4)

The zerglings die and the mutalisks do not, by a factor of five. The army loses, and it loses in a way that no amount of zealots fixes, because the zealot column against mutalisks is zero and zero times anything is zero. The value of knowing that in advance is the difference between attacking and sitting under your cannons, which is how the lecturer put it and is the best line in the section.

Where the model is honest about itself, at more length than it spends on the model. Three limits, in the lecturer's order:

  1. Appropriation is not really a vector. Sending the right part of your army at the right target is a choice per pair, not per target, so it wants a tensor. He said so and declined to do it.
  2. EE is not constant. Upgrades, terrain and position all change it, so strictly there is a different table for every upgrade state. T3 is one whole guide about a single one of those terms.
  3. EE is not separable. This is the good one. A medic kills zero zerglings. A marine alone kills about one. A marine and a medic together kill three or four. Support units cannot be given a row at all under a linear model, because their contribution is not theirs.

The repair, and the nicest idea in the lecture: keep the linear table and add a sparse correction that is zero almost everywhere.

E^=E^0+E^\hat{E} = \hat{E}_0 + \hat{E}'
(5)
E-nought is the constant table you can do ordinary linear algebra on. E-prime is zero except in the few cells that need a function.

The two cells he worked: the medic entry becomes a function of how many marines are with her, and the science vessel entry becomes a function of time, because irradiate damage accrues rather than being dealt. That is sparse correction modelling, arrived at by a second year physics student at a whiteboard, and it is a better idea than the matrix it is fixing.

Under fog. Run the same machinery with QQ as a distribution rather than a count. Each entry is bounded by what they can afford and zeroed by what the tech tree forbids:

Qj    R(t)cj,Qj=0   where the tech tree says soQ_j \;\le\; \frac{R(t)}{c_j}, \qquad Q_j = 0 \;\text{ where the tech tree says so}
(6)
Total resources over unit cost is a hard ceiling. An ultralisk at six minutes is not unlikely, it is impossible.

Then scouting collapses the distribution to a number, and time re-spreads it at the rate of their income. Which is T4, arrived at from the other direction, from the other side.

What to do with this at seven minutes

You are not going to invert a matrix mid game. Here is what you can actually use at the keyboard.

Name the denominator before the fight. One sentence: what am I short of. If the answer is gas, count both armies in gas and you will often find that a fight you were avoiding is fine.

Find the zero. The zealot column against mutalisks is zero. Every army has at least one of these, and the single most useful thing the matrix does is make you look for it. If any of their unit types has a zero or near zero in your whole army, the fight is lost regardless of the rest of the table, because you cannot allocate your way out of a zero.

Ask where the fire is going. Your army will choose its own targets if you let it, and its choice is almost never the allocation you would have picked. That gap is what micro is for, which is T7.

Price the support. When you are deciding whether the last two hundred minerals should be one more combat unit or the thing that supports the ones you have, remember that the support unit's value is multiplicative and the combat unit's is additive. Multiplicative wins as soon as the army is big enough, and it loses badly when the army is small.

What the lecture said

Lesson 2 sets up the matrix, and the first twenty seven minutes of the lesson 3 lecture work it through before turning to micro at 27:00. If you want to hear it explained, the derivation of the product runs from 3:00, the worked example from 9:00, the limitations and the sparse correction from 16:00, and the imperfect information section from 21:00.

The lecturer was candid about the payoff, and it is worth repeating because it is unusual: asked in effect whether any of this would help anyone's game tomorrow, he said he really, really doubted it. His claim was narrower and better: that it helps once you start reasoning about unit combinations rather than about units.

He also told the class to use MATLAB rather than a calculator. You do not need to: the Battle Lab runs the fight for you, and for a quick answer at the keyboard the three habits above are enough.

Still true today

Checkpoint

  1. Late game, you have 6,000 gas and 700 minerals banked. Which currency should you price the fight in?

  2. Why can a medic not be given a row in the efficiency table?

  3. Their army has a unit type your whole army scores near zero against. What follows?

Sources for this page