I have a working version of my combat simulator up and running in Python. It's relatively simplistic at the moment, you can generate a squad of troops of any size equipped with specific ranged and close combat weapons. These squads can shoot at each other and fight in close combat, recording the number of wounds and reducing squad size etc. For those of you who are interested in programming, each squad is an instance of a class, with attributes specified for the selected troop type and methods for all aspects of shooting/assault as well as saving rolls and recording wounds. I've tried to make the code as modular as possible so special rules can be added easily in future.
Once I bug tested the code a bit, I started simulating some fire fights between squads. The simulations were pretty simplistic with each unit just standing and firing at each other until one squad dies. Now I realise that in a game of 40k the situation is almost always much more complicated than that (there's many units, cover, special weapons, characters, squads can break, there's objective to capture etc etc), but the whole point of computer modelling is to try and strip back all the complexity and determine how the system works fundamentally. This allows you to see things that are obscured normally as varying parameters, even slightly can have dramatic and unintuitive effects in any complex system.
At first I was interested in looking at how weapon skill, ballistic skill, strength, toughness and saving throws effect the outcome of combat, and these all had interesting results (which I'll explore more deeply in later articles), but then I started to vary relative squad size and I found the results to be quite surprising.
Simulations were run for fire fights between Termagants (varying squad size) and a tactical squad of 10 Space Marines, both of these had no
upgrades using fleshborers and bolters (no rapid fire) respectively. Each squad fired at each other alternately and removed casualties. No morale checks were simulated and combat took as many turns as necessary to wipe out one squad. This was repeated 1000 times and the victor was recorded, and this was used to give a percentage win rate. The number of Termagants was increased and the simulations were ran again. Here's a plot of the results with the ratio of marines to gants (i.e. a value of 1 is 1/1 so 10 gants and 10 marines, so a value of 3 is 3/1 = 30 gants to 10 marines) against the gant success rate:
As you can see there is a sigmoidal relationship between relative squad size and success rate in combat, and this is not only true for shooting but assault as well. Before I did this I assumed there would be a linear relationship i.e. the success rate would increase proportionally one squad got bigger than the other. If this were the case double the amount of troops would double the success rate. I dare say some of you reading this would have realised why this is not the case, but I'll explain why for the rest of us.
Every time a model is killed, not only does the squad size decrease but its combat effectiveness drops as well. As the combat progresses, a compound effect arises where due to its reduced damage dealing potential, the (eventual) losing squad becomes very unlikely to kill enough of the enemy to reduce their damage dealing ability quickly enough to win themselves. And so it becomes more and more likely that the enemy will kill far more troops.
This is all very well but what does it mean in relation to the game itself and how can you apply it? Due the exponential section of this plot (the steep part) certain engagements are going to have really unpredictable outcomes. This can make the combat quite exciting but is not very helpful if you're trying to plan ahead into subsequent turns. However, it also plateaus quickly allowing you predict how many more troops are required to win a particular engagement with high certainty. This allows you to use your force more efficiently as you can then commit those troops and no more, which could potentially be only a very few pts worth of models. For example, I first noticed this effect when I ran a simulation with 25 gants vs 10 marines (just to test the code), the gants came out with a 40% chance of winning the combat. I reran this with 30 gants and 10 marines, which predicted an 80% chance of the gants winning, doubling the win rate for only 20 points! The same result would occur if you reduced the starting number of marines slightly too, so a single volley from a long range weapon could flip the odds of winning.
Taking the idea further, it makes sense that the ratio required to win combat also changes based on who fires/strikes first:
This
plot contains the original simulations (in blue) where the termagants
shot first and another set of simulations where the marines shoot first
(in red). Again this makes sense as the unit that fires second has
reduced combat effectiveness going into the fight. This information makes me value high
initiative models even more as striking first every round of combat
could have a dramatic effect on the outcome of the assault.
These simple simulations are not meant as a way of guaranteeing victory or saying "unit x is better than unit y", but they absolutely could help players choose engagements more sensibly and predict more accurately the outcome of the various situations that arise in a game of 40k. There are some caveats to what I said here, multi-wound models behave differently as they can take wounds and not have their combat effectiveness reduced, so think about how this might effect your troops. I'm still tinkering away on the combat simulator but if anyone would like a copy of the code please ask in the comments section. I'll have another analysis article next weekend, any suggestions on what to discuss are welcome.
Thanks very much for reading!
Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts
Saturday, 31 May 2014
Sunday, 25 May 2014
Analysis - How valuable is a Tervigon?
| Image copyright Games Workshop. |
At 195 points it's the most expensive non-unique HQ choice in the codex. It's hardy enough, with toughness 6, 6 wounds and a 3+ save, but is not as well equiped for combat as other options with 3 attacks and limited anti-infantary weapons. You could end up with some anti-tank options from Warp Blast when generating power of the hive mind, but you'll only get that one in six games so you couldn't rely on it. What you end up paying for is its most interesting ability, "Spawn Termagants".
For those of you that are unfamiliar, "Spawn Termagants" allows you to roll 3D6 a turn and spawn that many Termagants (basic Tyrannid foot soldiers), which is super cool. However, if you roll a double then you spawn that number of Termagants but you cannot use the ability for the rest of the game. With 3D6 it seems quite likely you'll roll a double, but what are your chances? Well using a really simple script you can simulate rolling 3D6 millions of times in a few seconds and count how frequently you get a double. Here's the script:
You could probably do something similar in Excel even, but this sort of thing is pretty simple to do in Python. In the end it spat out that it rolls 556513 times with no doubles and 443487 times with doubles. Obviously that works out as 55.7% of the time you'll get to roll twice. If we expand on this a bit more, we can simulate rolling every turn and seeing how many Termagants are generated on average each game (I ran 1000000 simulations again). Here's the code:
On average 22 Termagants are spawned before a double is rolled, with a standard deviation of 15.773. 22 Termagants at 4 pts a pop works out as 88 pts worth of free models on average per game. Effectively this reduces the cost of a Tervigon to 107 pts, but obviously there will be times when you roll poorly and don't get anywhere near close to that many critters, and conversly you'll occasionally get many more. Even with its more limited combat ability it should be relatively straight forward to make up 107 points in combat.
The final thing to consider is "Synaptic Backlash", which deals 3D6 [str 3, ap -] hits to Termagants units within 12" when the Tervigon dies. The damage of "Synaptic Backlash" can be easily mitigated by not being over-reliant on the Tervigon for synapse and managing your wounds to avoid massive damage to surrounding unit.
Overall, I think it should actually be possible to make back the points cost of a Tervigon just from its support abilities such as synapse, "Spawn Termagants" and "Brood Progenitor" (which gives Termagants within 12" counter-attack), along with potentially more from its power of the hive mind. But I think this'd be a waste in most games, so get it stuck into combat and crush some of those under-evolved lumps of biomass and make back those 107 remaining pts! Before this analysis I was slightly sceptical about the Tervigons cost-effectiveness but I'm a convert and will definitely pick one up. If you're considering using one in your army then you'll need to weigh up how happy you are to add another random element to your strategy.
I'm planning to do a lot more of this type of "Analysis" article in the future, generally focusing on Tyrannids, but if any readers have suggestion for topics for analysis for any army, let me know and I'll see what I can do.
Labels:
40000,
40k,
analysis,
Brood Progenitor,
scripting,
simulation,
Spawn Termagants,
Termagants,
Tervigon,
Tyranids,
Warhammer
Subscribe to:
Posts (Atom)