24 July 2010

God Bless Nerds

If you follow any web-comics or comics-blogs, you might have heard something about ComicCon happening this week in San Diego. You might also have learned that the despicable Fred Phelps and his Westboro Baptist Church Hate Group* were going to be there picketing the event. Con-goer heard this too, and they have responded in fine fashion. Blog posts with pictures, commentary, and video are available from:

Comics Alliance [photo to right]

TV or not TV [photo below]

Phyrangula [That wretched hive of scum and villainy where I acquired the other links]


* You DO NOT want to know any more than what is on the Wiki page. Trust me on this.
GBR Giant Battling Robots Favicon

09 July 2010

Lanchester's Laws and Attrition Modeling, Part II

In Part One I introduced the basic concept behind Lanchester's Laws, and now I want to write more about how this applies to games. This time I'll start off with Ernest Adams' excellent 2004 Gamasutra article, and follow up with my take on actually applying this to a game.

[Alternate Link to Ernest Adams article, in case the Gamasutra link flakes out again.]

Adams makes a particular good point about Lanchester's Laws and "victory".

Now, Lanchester's Laws are far from perfect. For one thing, they only apply to battles of attrition, in which the object is to wipe out the other side. If "winning" a battle is defined in some other way -- and modern Western militaries don't normally consider slaughtering every last opponent to be a legitimate objective -- then Lanchester's Law has nothing to say about who wins. Napoleon "won" every battle he fought in his march into Russia, but he still lost 98 percent of his men and was forced to retreat without achieving his objective.

On the other hand, some wargames are often fought to the last man standing, so if you are trying to understand game balance it is well worth considering. Some early comments tell me that rest of this post may be a confusing slog through a lot of math - I'm afraid that is the nature of the beast. All I can do is ask the reader to bear with me for now, and stay tuned for Part III where there will be some more accessible examples. I will start of again by stating my assumptions, fixing some errors I made last time.

This is a very simplified model of combat; Each side has identical soldiers; Each side has a fixed strength which governs the proportion of enemy soldiers killed. Range, terrain, movement, and all other factors that might influence the fight are either abstracted to the proportion killed or ignored entirely. In the derivation from differential equations casualties are inflicted continuously over time, but it also works to think of casualties inflicted in rounds or turns, which will be a more familiar setting to most gamers.

My first error last time was stating this in terms of the probability of killing an enemy soldier instead of a proportion or kill-rate. The differential equation derivation of Lanchester's Laws is a deterministic relationship that does not involve probabilities at all. I'm a statistician and tend to think in terms of probabilities rather than fixed proportions, and I'm also working my way up to demonstrating a probabilistic derivation of the same thing, so forgive me if I got a bit ahead of myself. A definition involving probabilities should be even more useful because it will demonstrate the degree of uncertainty involved in a balanced game.

My second error was in describing the total casualties for the winning side in my example. Side 2 loses all 2000 soldiers, and side 1 suffers casualties equal to 4/9ths (44%) of 2000 soldiers, for a total of 889. I had incorrectly stated that side 1 would lose 4/9ths of its total force (which would be 1400 soldiers), and the previous post has been corrected.

Notes on some abbreviations I may use (some changes since part one):
  • Pk = "Proportion killed" or combat effectiveness, with subscript k1 or k2 if it matters. This is usually a small proportion. 
  • RPk1/Pk2 , the ratio of combat effectiveness. (1/R = Pk2/Pk1)
  • N1N2 = The initial force sizes (before combat) of each side.
  • n1, n2 = The remaining force sizes at the end of combat.
  • C1C2 = The total casualties suffered by each side at the end of combat (C1 = N1 - n1).
  • a = Exponent on the force size. For the Linear Law a=1, and for the Squared Law a=2.
  • "~=" is used to represent "approximately equal to".
  • Be aware that the !@#@!#%&*#!!! Blogger editor is subverting every effort to use smaller fonts as subscripts in the text. Hopefully the subscripts will be clear from context.
Here is a an expanded version of the formula from part one. That formula only worked in a special case; this is more general:
[Edit: The k1 and k2 subscripts are reversed, dangit.]

This is a more general form that accounts for both the Linear and Square Laws, adds the relative combat effectiveness Pk's, and allows for situation in between with 1<a<2. This assumes the condition of combat and acquiring targets are the same for both sides, and so the value of a is the same for both. (Yes it can be different, but that really complicates things). I should also clarify that in a battle to the last man standing, where either C1 = N1 or C2 = N2, or equivalently n1 = 0 or n2 = 0 (one side is completely destroyed).

If a game is perfectly balanced then both sides should be destroyed at the same time, which results in both n1 = 0 and n2 = 0. Plugging these in and a bit of algebra gives:
Some important points:
  1. THE important point of Lanchester's Laws, is that the exponent representing the advantage of a higher rate of target acquisition applies to the size of the force (N), but not to the fighting effectiveness of the force (Pk). Under the Squared Law, any advantage that army 1 might have in combat effectiveness is usually quickly overcome if army 2 has the larger force. 
  2. Lanchester's Laws are not a governing rule of combat, they are a description of an ideal principle. In actual combat/play this ideal is unlikely to hold. If one player has a range advantage (tending towards a=2), other other will make use of terrain to counter this (tending towards a=1). Battles tend to occur in sets of smaller skirmishes, each with it's own circumstances, and the final result may represent some average of these skirmishes. 
  3. There is a third variation on Lanchester's Laws, known as the logarithmic law, which has relevance to interpreting historical data, but that will have to be a topic for another day.

So how is this used to balance a game? Let's suppose we have a hypothetical game where combat can potentially operate under the Squared law, but due to range and movement limitations effectively operates somewhere between Linear and Squared. I'll use a=1.5 to represent the actual state of this game, and work out examples under three cases:

Example 1 (Balance relative effectiveness):
  1. For the Linear Law a=1.0, N1 = 3000, N2 = 2000, Pk1 = 0.01, and solving for Pk2 gives Pk2 = 0.015 and R = 0.67 (or 1/R = 1.5).
  2. For the Squared Law a=2.0, N1 = 3000, N2 = 2000, Pk1 = 0.01, and solving for Pk2 gives Pk2 = 0.0225 and R = 0.444  (or 1/R = 4/9 = 2.25).
  3. For my in-between value of a=1.5, and again N1 = 3000, N2 = 2000, Pk1 = 0.01, and solving for Pk2 gives Pk2 = 0.018371 and R ~= 0.554 (or 1/R ~= 1.84).
If I want to balance a scenario with these forces (or any 3:2 force ratio) side 2's forces will need to be between about 1.84 times as effective as side 1's in order for this to be a fair fight. What actually happens in the game will still depend on chance and the ability of players to take advantage of opportunities during play, but that's the hypothetical balance point.

Example 2 (Balance force sizes):
  1. For the Linear Law a=0.01, N1 = 3000, Pk1 = 0.01, Pk2 = 0.015 and solving for N2 gives N2 = 2000.
  2. For the Square Law a=2.0, N1 = 3000, Pk1 = 0.01, Pk2 = 0.015 and solving for N2 gives N2 ~= 2450.
  3. For the in-between a=1.5, N1 = 3000, Pk1 = 0.01, Pk2 = 0.015 and solving N2 for gives N2 ~= 2289.
If I want a balanced scenario where the sides have this relative effectiveness (2:3 ratio, R = 0.67) side 2 will need an initial force size of about 2450 2289 to balance with side 1 in a fair fight. The outcome still depends on what happens in the game, but that's the hypothetical balance point.

Note that I arbitrarily chose a=1.5 for this example, pretending that I have a game where this is true. In practice I don't think it is possible to design a game to a particular value of a. What you can do is assume a value for a and design a game around it, assigning values and balancing scenarios with different types of units in this manner. This is difficult though, because in a game with many different types of units there is potentially a different balance point for every pair of units that might face each other, and there isn't any simple formula that can solve it for for us. This process gets VERY complicated.

At this point I have probably created more questions than I have answered. That is a problem, but I need to stop somewhere. The next part will hopefully include some more accessible examples, and some toy spreadsheets you can download to play with.
In my research I found two recent papers by Perry that were very helpful (especially 6 below) and greatly improved my own understanding of the topic. The MacKay paper (4) is maybe a simpler article to read first. You don't necessarily need to understand differential equations to read these, but it helps.

Part III of this series is here.

Bonus Link!

Lanchester Systems and the Lanchester Laws of Combat
by "The Custodian" at everything2.com
This is another basic introduction to Lanchester's Laws. The author (semi-anonymous) spends more time on the differential equations and some practical aspects that I glossed over completely, so it might be worth your time.

References and Reading (updated since part one)
  1. Ernest Adams, "Kicking Butt By the Numbers: Lanchester's Laws", a Designer's Notebook, Gamasutra webzine, August 4, 2004.
  2. Bruce Fowler, De Physica Belli: An Introduction to Lanchestrial Attrition Mechanics Part One, Defense Modeling Simulation and Tactical Technology Information Analysis Center, Huntsville, AL, 1995.  [Early versions of this series can be found online at DTIC: 1,2,3.]
  3. Michael J. Artelli and Richard F. Deckro, The Journal of Defense Modeling and Simulation: Applications, Methodology, Technology 2008 5: 1-20
  4. Niall MacKay, Lanchester combat modelsarXiv:math/0606300v1 [math.HO] (2006)
  5. Wikipedia contributors. "Lanchester's laws." Wikipedia, The Free Encyclopedia. Wikipedia, The Free Encyclopedia, 3 May. 2010. Web. 23 Jun. 2010.
  6. Perry, Nigel. Defence Science and Technology Organisation (Australia). Joint Operations Division 2009 Fractal effects in Lanchester Models of Combat [electronic resource] / Nigel Perry Defence Science and Technology Organisation, Canberra.
  7. Perry, Nigel. Defence Science and Technology Organisation (Australia). Defence Science and Technology Organisation (Australia). Defence Systems Analysis Division. 2006 Verification and validation of the fractal attrition equation [electronic resource] / Nigel Perry DSTO, Edinburgh, S. Aust.
GBR Giant Battling Robots Favicon

02 July 2010

Range Testing for Little Wars

Over at Toy Soldiers Forever, Mannie is preparing to play one of the original miniatures rules wargames.
Last winter I acquired a reprint of H.G. Wells' Little Wars, that most original and elegant of wargaming tretises. First published in 1913, this very slim volume set an early standard for wargaming in which the obvious agenda is fun and the not-so-hidden agenda is the futility of war and the advantages of peace.

The clever prose and the droll attention to simplicity and pragmatism make this a delight to read.

Mannie clearly takes delight in testing his new toy cannon too. He's even done a very scientific study of projectile performance. I like it!

 I'm looking forward to the report on the full scale battle too, coming later this month.
[Image From Mannie Gentile: Toy Soldiers Forever]
GBR Giant Battling Robots Favicon