19 November 2008

Hammer's Slammers Math (Take 2)

I tried this post before, but I decided I really wanted to do a better job of it. The game Hammer's Slammers has point value for units to aid in creating scenarios, not unlike Battletech's Battle Value. Many games have such point-value systems, but this Hammer's Slammers game is particularly suitable for the sort of simple examples I need to get started. The entire games rules are only about 5-6 pages, and the portion that deal with resolution of combat is maybe half of than. My main goal is to demonstrate a statistical way of looking at the basic mathematics of the game. I'll start off with a bit more about how the game actually plays, or at least the detail of how combat is resolved.

Here is the description of the games counters, and if you have any familiarity with typical wargames then this is pretty standard. This particular counter represents a Supertank, and is the most powerful unit in the game. It has attack and defense factors of 8 each, a range of 4 hexes (8 hexes at 1/2 attack factor) and can move 6 hexes per turn.

To the right is the Combat Results Table (CRT) from Hammer's Slammers as I have recreated it. The attacker declares which units (within range) will attack the defending unit(s) in a single hex (stacking limit is 3). They sum up the attack factors of all attacking and defending units, then find the column that is closest to the ratio of attack to defense factors (rounding down), then roll 2d6 and look up the result. I am mostly interested in the probability of "Dis" and "DE" results, and so will ignore the additional results related to turning hexes to rubble.

An example may be helpful: An attacker with one Supertank (attack factor 8) is attacking a Combat Car (defense factor 4). The ratio is 8 to 4, or 2 to 1. The attacker rolls 2d6 and gets an 8. Looking this up on the "2-1" column of the CRT gives the result "Dis". The Combat Car is disrupted and the counter is flipped over to indicate this. If the Combat Car had already been disrupted, this result would destroy it. If the attacker had rolled a 9 instead of an 8 it would have been destroyed outright.
In this game most Infantry units are never disrupted, and are only affected by "DE" results. The exceptions are not relevant for this discussion.

There are two probabilities to be considered. The first if the probability that an attack either Disrupts or Destroys the defending unit. The second is the probability the defending units is Destroyed. These probabilities are represented in the chart at the right with the Attack-Defense ratio on the X-axis and the probability on the Y-axis. (Actually, we might also consider the probability of a unit being Disrupted and not destroyed, but I'll save that for another day.) These probabilities are basic to understanding the game, but this is not the only way they can be represented.

This is the same graph except the Y-axis now represents Odds instead of probability. If the probability of an event is equal to P, then the Odds of the event are P/(1-P). I have fudged a little bit where the probability that a unit is either Disrupted or Destroyed is equal to 1.0; here the odds are undefined (divide by zero) and I have arbitrary substituted of an odds of 90 so I could have complete graphs here. While probabilities are between zero and one, the odds range from zero to infinity, and large values are not uncommon. It is often useful to consider the odds on a different scale of measurement.

Now here is a different scale. The Y-axis now represent the natural log of the odd (log-odds), and the X-axis is log-base-2 of the attack-defense ratio. This is an odd decision of my part to use two different logarithmic scales. I chose log-base-2 for the X-axis simply because the graph looks nicer: "0.0" is at zero on this scale, and each doubling (or halving) of the A/D ratio is a shift of 1.0 on the log-2 axis. Otherwise, there is no reason to used log-base-2 instead of the natural log.
Note that the relationships between the log-odds and log A-D ratio can be approximately represented by a straight line, or by the equation of a line, such as
Log(Odds) = A*Log(A/D) + B,
where A and B are coefficients that define the line.

Representing this relationship by the equation of a line is easily accomplished by use of linear regression - a basic statistical technique with a multitude of applications. The implication I am (finally!) getting at, is that there is a statistical way to describe the relationship between attack factor, defense factor, and the probability of a unit being destroyed (or disrupted).

There is more to consider: In a typical game units may be attacked more than once before being destroyed (and in Battletech this is a certainty). To look at what happens when a unit is subjected to a sequence of attacks I will need to discuss survival distributions. Stay tuned.
Post a Comment