So, for the record, here's the nitty-gritty detail on how the "accuracy" modifier works, including code snippets for those to whom these things make sense.
if (aip->time_enemy_in_range > 2*range_time) {
scale = (1.0f - aip->ai_accuracy) * 4.0f;
} else {
scale = (1.0f - aip->ai_accuracy) * 4.0f * (1.0f + 4.0f * (1.0f - aip->time_enemy_in_range/(2*range_time)));
}
The "scale" factor determines how far off the aim can be: take the "ideal" point to shoot at (where the lead indicator is), add an arrow pointing a random direction, and make the arrow "scale" units long. The AI will aim at that point on the end of the arrow.
The scale variable is also affected by EMP and stealth, but we'll ignore that for now.
So, the factors that affect scale, and thus AI accuracy (in terms of not shooting at the lead indicator), are:
1.
ai_accuracy: this is an AI.tbl setting (
$accuracy).
2.
time_enemy_in_range: this number fluctuates up and down from a variety of factors, but as implied by the name, generally goes up the longer the target is within range.
3.
range_time: This number is calculated as 2.0 + (
$AI In Range Time), where
$AI In Range Time is an AI Profiles and/or AI.tbl setting. In Team vs Team multi missions, however, this number is just 2.0.
So, the minimum scale factor is:
(1 - $accuracy) * 4
For accuracy of 1.0, this gives a value of 0, meaning perfect aim. For an accuracy of 0, this would give a scale factor of 4.0... not perfect, but still not obnoxiously far off. Given enough time in a dogfight, the AI will converge to this equation and those values.
In the meantime, it uses this equation:
(1 - $accuracy) * 4 * (1 + 4 * (1 - time_enemy_in_range/(2*(2+$AI In Range Time))))
The bottom line is that how quickly the AI converges from least accurate to most accurate is affected by $AI In Range Time. The
worst possible aim the AI can have seems to be fixed at 20 (for $accuracy = 0). It appears that accuracies outside of the 0-1 range will work, and do affect that number. Accuracy less than 0 will make the AI more inaccurate, but once you go above 1.0, accuracy starts to drop off again(see graph A).
EDIT: One more thing. There is no point in lowering $AI In Range Time below -2.0. Once it's at -2 or below, the code will always take the first branch (so the AI is always using max accuracy).
Some graphs (remember, smaller result for scale factor means more accuracy, where 0 is perfect accuracy).
A.
Scale factor (y) in terms of $accuracy (x) (after AI has been in range a while)B.
Scale factor (z) in terms of $accuracy (x) and time_enemy_in_range (y) with $AI In Range Time=1.0C.
Scale factor (z) in terms of $accuracy (x) and time_enemy_in_range (y) with $AI In Range Time=3.0This probably deserves it's own post, but what the heck.