Tuesday, 14 September 2010

Quad Negative

This didn't fail to amused me. From :

The User will not use, nor will it sell or make available to any person,
the Information for the purpose of issuing Independent Forecasts or
Warnings unless:
(ii) the additional forecasting elements are not inconsistent with the
Bureau's Forecast;

TLDR: Will not ... unless ... not inconsistent

Saturday, 11 September 2010

Starcraft 2 Automated Unit Tests

No, not that sort of unit test.

As an exercise, I made a Starcraft 2 map that pits various sizes of starting-unit squads against each other. This post covers the initial results of my test.

This graph shows how many units Player 1 (P1) had left after attack moving through Player 2's (P2) squad (while P2's squad was likewise attack moving through P1's squad). All the fights resulted in victory for one side, so if P1 had any units left, P2 had none. Only fights that P1 won are displayed. It says "no micro" because there was no micromangement, only the default AI was used. A good human player can improve a unit's performance by issuing more specific orders (focusing fire, pulling back damaged units etc).

How to read the graph

The first column of subgraphs shows the fights where P1 used Marines. Likewise the first row of subgraphs shows the fights were P2 used Marines. Within each subgraph, the number of units that each player starts with is varied from 1 to 8. The leftmost column of each subgraph shows the results of fights where P1 started with only 1 unit. The topmost row of each subgraph shows the fights where P2 started with 8 units. Diagonal lines have been drawn through the numerically even fights (based on count of units, not cost).


The CSV file I used to generate the above chart can be found at http://abznak.com/pub/20100911.unittests.csv. You can ignore the columns with names beginning with "x". The other columns are, I hope, self explanatory.


I created a SC2 map that, every 30s, tested the next combination from:
type_1:[marine, zealot, zergling] x count_1:[1..8] x type_2:[marine, zealot, zergling] x count_2:[1..8]

The test consisted of:

  1. Spawn count_1 units of type type_1 at point_1

  2. tell them to attack point_2

  3. Spawn count_2 units of type type_2 at point_2

  4. tell them to attack point_1

I think all 4 of the actions happen at the same game time. Point 1 and point 2 were on an empty flat surface, on a horizontal line, 15m apart. (I'm going to call whatever distance unit the map editor uses "m", as saying "15 units apart" is confusing).

None of the units had any upgrades.


marines splitting fire between 2 zealots

In this situation, 2 zealots will beat 7 'lings and 3 zealots will beat 7 marines. But the there was no micromanagement, so, for example, in the 8 marines vs 8 zealots case the marines split their fire between the two lead zealots. Also, each test was only done once. Subsequent experiments have show that the outcomes are not always the same (sometimes one zealot will die in 8xZealot vs 8xMarines, sometimes all zealots survive).

Those of you that don't know SC2 should also note that for 100 Minerals you can by 1 zealot, 2 marines or 4 zerglings.


I used the SC2 map editor, some commandline tools, R and ggplot2. Do email me if you'd like a copy of the map (maps at abznak.com). It's currently just a bit rough to publish.

Future Work

  • Try different units

  • Try repeating tests

  • Try fractions of units (i.e. damaged units)

  • Clean up the map

  • Write up the map

  • Write up the R code

But that's going to have to wait, because I feel like actually playing some SC2 now. I'm thinking 3 zealot rush.