How exactly is chance to hit computed?

I’m wondering how chance to hit is computed. I’ve found that Frigate Plasma will still occasionally miss against stationary targets even though it has a tracking speed of 1.00. So it seems a margin of 1.0 tracking doesn’t mean a 100% hit chance unless there’s some random chance to miss added to each shot.

On the other hand, I’ve noticed that massed Cruiser Pulse Lasers (2.6 tracking) seem to do a decent job of shooting down shoot down rocket fighters with a speed of 4.31 and 2.98 without too much trouble. So a margin of 1.71 doesn’t seem to be enough for safety, let alone 0.38.

A while ago, cliffski posted the core of the algorithm in the forums:

If the weapon’s tracking speed is greater than the target’s speed, the chance of hitting is (1-(target_speed/tracking_speed)) * (target_size/256 * 0.5 + 0.5). This would be 100% for a extra large (length 256) cruiser that is not moving, and goes to zero as the target’s speed approaches the weapon’s tracking speed or to 50% as the target’s size goes to from to zero.

There is also a chance on each shot of a “lucky hit.” I believe the odds of getting a lucky hit is 2%, but the exact chance may have tweaked since I heard that number. Lucky hits skip the regular hit chance calculation, and will always hit their target (except in the cases of missiles that are too slow and unmaneuverable to reach their targets before running out of fuel).

In the situations you described, the plasma shots were occasionally missing because of the second part of the hit chance formula, since all of the regular ships have a size smaller than 256. The Pulse Lasers were only damaging fighters due to lucky hits, but probably after the first hit each damaged fighter was flying more slowly due to engine damage, and so was easy for the guns to finish off.

Aha, so ships with a larger hull are easier to hit. I never thought of that, but this might explain why identically configured Valhalla cruisers lose to Fenrirs. You sir, are brilliant! :smiley:

I suppose I will do sit down and do some maths later to figure out whether slightly faster Icarus fighters (12 meters) are harder to hit than the slightly smaller Achilles fighters (11 meters)…

By the way are “lucky hits” the same thing as the critical hits that allow laser fighters to eventually chew through armored cruisers?

I don’t know exactly how it’s coded, but the explanations I’ve seen suggest that they are different checks. Lucky hits skip over the “to-hit” calculation that takes place at weapon launch time. Critical hits skip the penetration checks, which I’m pretty sure must happen at impact time, rather than before.