Table of Contents

Sunday, 22 July 2018

Deviating templates


When you look at the history of wargaming, there are all sorts of strange contraptions that various rulesets use to determine area effects of firing. Most of these come in the form of firing templates. Usually, the template is placed on the table, and all figures underneath the template have some probability of getting hit.

Templates are an old idea. Below you see a cannister template from The Wargame by Charles Grant, which was soldered together.

Here's another curious template, from Don Featherstone's Advanced Wargames.

Especially fantasy rules have used templates in all forms and sizes. Here you see a selection of templates from my "templates box", most from various incarnations of Warhammer. The "Fallen Drunk Giant" template is still one of my favourites :-)

In order to bring more variability (and randomness) in the fire effect, some rules also specify that the template can "deviate" from the original position. A random direction is determined, a random distance is rolled for, and the template "deviates" that particular distance in that particular direction, to determine the final area where the firing will have an effect.

There are various possible mechanisms to determine this random direction and random distance, and especially fantasy and science fiction rules have used a whole zoo of variations on this theme over the years.

It will be impractical to analyze them all in terms of probability and effect, but I have chosen one particular procedure using the "scatter die" and "artillery die", I believe first pioneered by Games Workshop back in the nineties (any corrections welcome!).

The idea is as follows:
  1. Place the firing template over the intended target.
  2. Roll the scatter die to determine direction of deviation (the direction of the face-up arrow). However, the scatter die also has 2 "Hit" faces, indicating no deviation at all.
  3. Roll the artillery die to determine the distance. The die can give 2, 4, 6, 8, and 10 as a result, along with a "misfire" that usually ends up in some hilarious effect for the crew firing the war engine.
What I want to do next is to analyze this procedure in terms of "probability getting hit" when a figure is located somewhere within the possible deviation area. I will not consider the direct hit or misfire effects, since these should be considered as separate probabilities and events. We will only look at the probabilities when scattering does take place, with any of the 5 possible distances.

Distribution of position of the template

Let's take a look at where the template might end up when there is a deviation. To make matters easier, we will consider a template with a 2" diameter (1" radius), and consider the artillery die distances in inches as well. This is a common application of the procedure, and can also be found in various Games Workshop games.

The diagram below shows the possible positions for the template, when the deviation would happen in the horizontal direction.

When taking into all possible random directions (a few are drawn below), a pattern starts to emerge.

It is obvious that the further you move away from the initial position of the template, there is less chance that any particular area will get covered by the deviated template. Indeed, the same number of possible template positions have to cover an ever-increasing larger circular area. Hence, the closer you are to the initial point of impact, the higher the probability your figure will be hit.

Let's look at this probability in some more detail.

Because the artillery die has equal probabilities for distances 2, 4, 6, 8 and 10 (remember, we ignore the misfire result), there is an equal probability for the template to end up in any of the 5 concentric circles.

Each of these 5 concentric range bands has its own area, which can easily be computed by subtracting the area of the smaller circle from the bigger circle. E.g., to compute the area of zone C, we compute

(7*7 - 5*5) times pi (area of a circle is pi times its radius squared) = 24pi.

The areas of all zones, using the same method of calculation:
  • Zone A: 8pi
  • Zone B: 16pi
  • Zone C: 24pi
  • Zone D: 32pi
  • Zone E: 40pi
The firing template itself has an area equal to pi (= pi*1*1). Therefore, if the template would end up somewhere in Zone C, it will cover a proportional area of its area divided by the area of Zone C = pi / 24pi = 1/24 = 4.17%. Thus, if a figure would be located anyewhere in Zone C, there's a 4.17% probability it will get hit if the template ends up in Zone C and the direction is generated randomly. For all zones:
  • Zone A: 12.5%
  • Zone B: 6.25%
  • Zone C: 4.17%
  • Zone D: 3.13%
  • Zone E:  2.5%
We made a simplifying assumption that the figure only has the dimensions of a single point. In reality, the figure itself covers some area, and if you count overlap between the figure and the template as well, probabilities will go up somewhat. BTW, this is one of my objections against using templates which are too small or have a strange shape w.r.t. to the size of the figures, since discussions w.r.t. overlap will always arise ... but I will keep that discussion for another blogpost.

Overall hit probability

Since each of the range bands has a 20% chance of occurring, the overall probability of a figure, located somewhere in the total possible impact area, is then as follows:
  • Zone A: 12.5% *1/5 = 2.5%
  • Zone B: 6.25% *1/5 = 1.25%
  • Zone C: 4.17% *1/5 = 0.83%
  • Zone D: 3.13% *1/5 = 0.63%
  • Zone E:  2.5% *1/5 = 0.5%
So, one can see this is a degrading probability the further the figure is located away from the point of impact. Depending on your assumptions on how such deviation should be modeled, this might make perfect sense. But you can also wonder how you will have to adapt the probabilities for ending up in each zone, such that the probabilities of getting hit are equal anywhere in the possible deviation area.

In order to achieve this, we have to adjust probabilities in proportion to their relative areas. Since the areas of Zone A, Zone B, Zone C, etc. are equal to 8pi, 16pi, 24pi and so on, we simply will have to design a randomizer proportional to these areas, and making sure that all probabilities sum up to 1. The sum of 8+16+24+32+40 = 120, and thus:
  • Zone A should be generated with a 8/120 = 6.67% probability
  • Zone B: 16/120 = 13.33%
  • Zone C: 24/120 = 20%
  • Zone D: 32/120 = 26.67%
  • Zone E:  40/120 = 33.33%
I'll leave it to the reader to come up with a simple mechanic for generating such probabilities (apart from rolling a D120 :-))

Some more mathematics

The analysis made above is also related to the problem of generating points in a circle with uniform probability, which is often a textbook exercise in many Probability 101 classes. Since the area of increasing concentric range bands goes up quadratically (a pattern that you can also see above), a random point can be generated by picking a random direction, and picking a random distance from the origin by taking the square root of a uniform random number generated between 0 and and the radius squared. Simply picking a random distance uniformly between 0 and the radius would produce a spread of points located closer to the centre of the circle.

Monday, 30 April 2018

An analysis of combat resolution in Rommel

Recently we played our first games of Rommel (see my regular wargaming blog), a WW2 ruleset published by Honour.

The procedure for resolving combat felt a bit unusual to me, so I decided to analyze the procedure from a mathematical point of view. Note that this post is not a review of the ruleset as a whole - which I like very much for some its original concepts and clever ideas.  But I am always interested in analyzing specific procedures, how they work, and whether we can gain some additional insights from running through the numbers ;-)

Combat resolution in Rommel

First, let's take a look at how combat resolution in Rommel works. Rommel is a grid-based ruleset, and when resolving combat, the combat factor of all the units that end up in the same gridcell are added together. A D6 is then rolled, and cross-indexed on the table shown below. One then has to count how many "yellow boxes" have a number equal or lower compared to the total combat factor, resulting in the number of hits on the opposing units.

E.g., suppose we have a total combat strength of 15, and I roll a 3. Looking at the "3" column, I count 2 yellow boxes (9 and 14), whose value is less or equal than 15. Thus, I inflict 2 hits on the enemy.

Note that since 3 units can occupy a single gridcell, and the combat factor per unit is typically 3, 4 or 5, we might have a combat factor in the 9-15 range. This can be modified due to tactical factors, artillery support, etc., but those are typical numbers (at least in the scenarios we played).

When I first played Rommel, I felt this "user interface" for determining the number of hits was a bit strange, and as a good DIY wargamer, I always wonder whether I can replace it with something more to my own liking, without compromising the initial outcomes too much.

Expected number of hits per combat factor

Counting numbered boxes seemed a bit non-transparant to me. It is difficult to judge whether the number of hits we can expect for a given combat factor in a gridcell goes up linearly, whether there are certain "clicks" that suddenly give an advantage, etc.

So the first thing to do is to compute the expected number of hits per combat factor. The expected value of a random process is simply the average value one can expect when repeating the process an infinite number of times, and is computed by averaging all outcomes, weighted by the probability that each outcome occurs. For our procedure, we have 6 outcomes per combat factor, and each has an equal likelihood of occuring.
E.g., let's compute the expected number of hits for combat factor 15. We could roll a 1 on the die, resulting in 1 hit, or we could roll a 6, resulting in 4 hits. Averaging over all possible outcomes we get:

expected hits = (1+2+2+3+3+4)/6 = 15/6 = 2.5 hits.

 Or course, we will never score exactly 2.5 hits, but this is an average taken over all possible rolls for combat factor 15.

In order to compute the expected value for all combat factors for 1 up to 40, I simply made a spreadsheet, listing the possible outcomes per combat factor as given in the original resolution table, and simply let the spreadsheet compute the average. Since the minimum and maximum number of hits could also be of interest, I plotted these in additional columns as well.

Hits on Die roll

Combat Factor 1 2 3 4 5 6 Expected Min Max
0 0 0 0 0 0 0 0.00 0 0
1 0 0 0 0 0 1 0.17 0 1
2 0 0 0 0 0 1 0.17 0 1
3 0 0 0 0 1 1 0.33 0 1
4 0 0 0 0 1 2 0.50 0 2
5 0 0 0 1 2 2 0.83 0 2
6 0 0 0 1 2 2 0.83 0 2
7 0 0 1 1 2 2 1.00 0 2
8 0 0 1 1 2 3 1.17 0 3
9 0 1 1 2 2 3 1.50 0 3
10 0 1 1 2 2 3 1.50 0 3
11 0 1 2 2 3 3 1.83 0 3
12 1 1 2 2 3 3 2.00 1 3
13 1 1 2 2 3 3 2.00 1 3
14 1 2 2 2 3 4 2.33 1 4
15 1 2 2 3 3 4 2.50 1 4
16 2 2 2 3 3 4 2.67 2 4
17 2 2 2 3 4 4 2.83 2 4
18 2 2 2 3 4 5 3.00 2 5
19 2 2 3 3 4 5 3.17 2 5
20 2 2 3 3 4 5 3.17 2 5
21 2 2 3 4 4 5 3.33 2 5
22 2 2 3 4 5 5 3.50 2 5
23 2 3 3 4 5 5 3.67 2 5
24 2 3 3 4 5 5 3.67 2 5
25 2 3 4 4 5 5 3.83 2 5
26 3 3 4 5 5 6 4.33 3 6
27 3 3 4 5 5 6 4.33 3 6
28 3 4 4 5 5 6 4.50 3 6
29 3 4 4 5 5 6 4.50 3 6
30 3 4 4 5 6 6 4.67 3 6
31 3 4 5 5 6 6 4.83 3 6
32 3 4 5 5 6 6 4.83 3 6
33 4 4 5 5 6 6 5.00 4 6
34 4 4 5 5 6 6 5.00 4 6
35 4 4 5 5 6 6 5.00 4 6
36 4 5 5 6 6 6 5.33 4 6
37 4 5 5 6 6 6 5.33 4 6
38 4 5 5 6 6 6 5.33 4 6
39 4 5 5 6 6 6 5.33 4 6
40 5 6 6 6 6 6 5.83 5 6

The number of expected hits goes up by combat factor (as we might expect), and the minimum and maximum number of hits go up as well. Note that these are the "raw results" before applying any modifiers after the roll, which in Rommel depends on tactical cards being played by one or both players.

To better understand this table, I also plotted these results in a graph:

As you can see, the expected number of hits goes up pretty much linearly, but there are a few places where the line could have been made smoother. E.g. there's a sudden jump for combat factor 26, which can be "smoothed out" by adjusting the table above if desired (see also appendix 1 below).

The dotted blue line is the linear "trend", as computed by the spreadsheet. You can observe that our expected value follows this trend fairly well, except near high combat factors. This is due to the maximum number of hits being 6. If 7 hits would be allowed near the end of the table, the expected value would increase slightly for those higher combat factors. However, since such large combat factors do not regularly occur in the game, we will not consider this effect any further.

The graph below shows an additional line, plotting the 0.15 times the combat factor. You can see that the blue trend line matches this 0.15*combatfactor very closely, except for a little offset near the origin.

A different combat resolution mechanic?

The interesting observation about the 0.15 line, is that it is very close to a slope of 0.1666... which is exactly 1/6. This number is promising, because 1/6 is exactly a single "chunk" of a probability step on a D6. Thus, can we design a procedure that produces as its expected value a number that is exactly 1/6 of the combat factor?

There are any number of different mechanics that can do this. A very simple straightforward one is to take as many D6 as the combat factor (thus, roll 15 dice for combat factor 15), and count any 6's as a hit. This produces an expected value equal to 1/6th of the initial combat factor. However, its variance is also very high. The number of hits could range from 0 to 15. See also Buckets of Dice mechanics for further exploring such a procedure.

So let us look at another procedure, and I suggest the following: Take as a fixed number of hits the multiple of 6 just below the combat factor, and any remainder left is used as the target number on a D6 to score an additional hit. E.g., for a combat factor of 15, we would score 2 hits (2*6 = 12); 15-12 = 3, so we need a 1,2,3 on a D6 for an additional 3rd hit. If our combat factor is 11, we would score 1 hit, and we roll a D6 with a 1,2,3,4, or 5 scoring another hit. If our combat factor is 19, we score 3 hits, and we score an additional hit of we roll 1 on a D6, and so on.

It is rather obvious that the spread for any given combat factor is 1 hit , but the chance for this additional hit goes gradually up for each additional unit of combat factor. The graph below plots the expected value for this new procedure, along with the minimum and maximum number of hits.

So, what can we see on this graph?
  • The blue line is the expected result for our new procedure, which follows pretty close the expected value for the original procedure.
  • The dotted blue lines show the minimum and maximum number of hits, which define a much more narrow interval compared to the original minimum and maximum values. I don't think there's a "right" or "wrong" aspect about this, it does depend what you like better: a higher  variability in results (a difference of up to 3 hits between die rolls) or a more narrow variability, with results being only 1 hit apart.
  • The "leveling off" of the blue line for high combat factors is due to the maximum number of hits being set at 6, as per the original procedure. Otherwise, a combat factor of 37 or over could possibly result in 7 hits according to our new procedure. But since such high combat factors do not show up in the game, we ignore this effect.
  • Our new procedure might be more user-friendly to resolve. The players can simply work out the number of hits without having to consult a table.
Other alternatives are possible as well, keeping the same expected value, but altering the minimum and maximum outcomes. E.g. if you like a Bucket of Dice mechanism, you could also divide the combat factor by 3, roll that many dice, and count any 4,5,6 as a hit. Or you could use a variation of what I suggested above, using D12's, etc. There are many possibilities, and in the end, it strongly depends on your personal preferences.

Appendix 1: Adjusting the original combat table

In hindsight, it isn't that surprising that the slope of the expected value is very close to 1/6. After all, this implies one additional hit for one die roll result when the combat factor goes up by 1. You can also see this in the original graph, when the slope of the expected value runs exactly parallel to the 1/6 line, e.g. in the range 14-19.

It is therefore rather easy to play around with the number of hits a little bit, to get an expected value line that runs exactly along this 1/6 slope. All it requires is to have the number of hits go up by 1 for one die roll result when the combat factor goes up by 1. There are different degrees of freedom to do this. E.g., if we start from the current line for combat factor 7, we have for die rolls 1-6: 0, 0, 1, 1, 2, 2 hits respectively. When we go to combat factor 8, the current table indicates 0, 0, 1, 1, 2, 3 hits (the number of hits for a die roll of 6 have gone up from 2 to 3). But you could also put it at 0, 1, 1, 1, 2, 2, which would result in the same expected value for combat factor 8, although with a slighter lower variation in results.

Actually, you could alter the table in such a way that it produces exactly the same outcomes as our modified mechanic. But I'll leave that as an exercise to the interested reader. You can play around with the combat results table yourself by downloading my original excel file.

Appendix 2: Fantasy Warlord

When I was doing the analysis for the new suggested procedure, I remembered I had seen a similar mechanic before. The fantasy wargaming ruleset Fantasy Warlord (Folio Works, 1990) uses % numbers for one figure hitting another figure. E.g. an Orc would have a 40% probability of hitting an Elf. If you have a unit of 8 orcs attacking, that would result in 8*40% = 320%, meaning 3 hits and a 20% chance of inflicting another hit.