Wednesday, May 18, 2016

Evaluate average to-hit probability, average hits and criticals in combat situation

You can find data sheets giving the probability to hit if you attack with three dice, have a focus, and the defender has 2 dice. In Squadron Benchmark, the menu entry "Probability" does just that for instance. However, what are the probabilities to hit when you have 4 ships with Twin Laser Turret firing on the same target ? What are then the average hits taken ?

This is the kind of situation now where Squadron Benchmark brings you an answer, in the version 0.8.8. Just press the button displaying the range of fire of the weapon, for as many units as you wish, it now displays additional information.


For instance, Vader, Soontir + Stealth Device + Autothrusters and a shuttle are here facing 2 Syndicate Thugs with Twin Laser Turrets.





 Pressing the primary weapon button for Vader shows now 3 values on the Thugs:
  • The to-hit percentage, corresponding to the probability to hit the target. Vader has 56% of chance to hit the first Thug, 41% to hit the second one
  • The average hit results: at the end of the combat, once all red and green dice have been compared, the attacked unit is dealt the hits and criticals that have not been cancelled. The mean value for each is shown here. The first thug takes in average 0.52 hits
  • The average crit result: Same as before for uncancelled crits. The first thug takes 0.19 crit in average.
What happens if the shuttle fires at the same turn ? The results shown for the first thug correspond to the updated values if BOTH Vader and the shuttle fire at it in the same turn: They have 88% of chance to hit it, with an average 1.36 hit result, 0.52 critical.
How is it computed ? The average results for hits and crits for Vader and the shuttle are simply added. For the to-hit probability, the probability to not hit is computed for Vader and the shuttle, they are multiplied and the final result is 1 - this probability to not hit, neither with Vader nor with the shuttle.



Now a more complex case.When the first Thug fires with the TLT, we can see he has 92% of touching the shuttle, taking into account both attacks. They perform in average 1.48 hits, and 0 crits (it's a TLT). For Soontir, the chance is only 43% to hit.

When both Thugs are firing at the same target, the shuttle seems an easy target with an average 2.92 hit taken by the shuttle.

The results are computed for the shuttle and Vader as if 4 different units were attacking them. The effect of Autothrusters needs more explanations. For each combat, the complete distribution of results is computed, associating for each combination of modified dice (red and green) the probability to see it: for instance, the probability to have 1 focus, 1 crit and 1 hit for the Thug, 1 evade, 1 focus and 2 blanks for Soontir is computed. The Autothrusters modify Soontir results into 2 evades, 1 focus and 1 blank and the probability is added to the probability to obtain this result. The average of hits and crits, the sum of probability for hit results are computed and displayed.

If Vader and Soontir have a focus token, we can see that the % to hit decreases, but not that much because if it is used in the first attack, it is no longer available for the second one.
Here the results for Vader and Soontir are only approximations: the values shown correspond to the case where the focus is always used for the first attack, and never available for the second one. The successive attacks are no longer independent, and this would require too much processing power for javascript, at least with a brute force method computing the whole distribution. So the real figures are actually lower than these ones. 

A last example, with Contracted Scouts, in order to evaluate the impact of Guidance Chips and of the Punishing One title. The topmost scout has only  Plasma Torpedoes+Deadeye, the second one has additionally Guidance Chips and the third one has Plasma, Deadeye, Guidance Chips and is the Punishing One (3 for primary weapon).
 The first ship  has 61% of chance of hitting the first IG-88 (both with Autothrusters) and only 48% of chance for the second one, at range 3 (Autothrusters effect).
 The Guidance Chips adds +24% of chance to hit the first IG-88, +30% to hit the second one. Not bad for a 0 point upgrade !

Finally, with the Punishing One title, the % to hit are the same, but the average number of criticals has significantly raised, from 0.45 to 1.18 for the first ship, 0.43 to 1.04 for the second one.







A real punishing attack, with all three Scouts, with focus and target lock (for firing the torpedo) for each, would deal 4.71 hits + 2.29 crit in average to the first IG-88, with their Plasma Torpedoes. More than 7 damages in average, a possible killing blow.
This is still a first draft for this probability evaluation and it may require some processing power. The web page may not be responsive while this is computing. This evaluation is part of the effort to improve the AI to better determine the threats and the force of its attacks.

The upgrades taken into account so far in the computations are the following.
  • Twin Laser Turret, TIE/D, Cluster Missiles, BTL-A4, Gunner, Luke Skywalker (crew), IG-88B for multiple attacks
  • Heavy Laser Cannon, Accuracy Corrector, Guidance Chips, Ion Cannon, Ion Cannon Turret, Ion Pulse Missile, Tractor Beam, Flechette Cannon, Adv.Homing Missiles, XX-23 S (modifying red dice or result)
  • Autothrusters (modifying defense dice)
All other upgrades/pilots that are not listed are not taken into account for the probability evaluation (Howlrunner for instance). The results are accurately computed for the listed effects. Tokens (evade, focus, target lock) are also taken into account, but an approximation is made when there are multiple attacks, since the tokens are assumed to be consumed after the first attack.

Enjoy !