Talk:Accuracy formula

From UFOpaedia
Jump to navigation Jump to search

From experience I think the chance of hitting an alien tends to be best if in an exact straight line (orthagonal or diagonal), and on the same level as it. This probably is explained by the misses that hit anyway, because you can miss slightly short and kneecap them, or long and hit them in the face, but I think this is less likely if you are at an oblique or acute angle (because there are less squares that are behind him you can scatter to, but still hit him - especially as you get further and further away so the aliens width becomes less of a factor). Equally with height, the further up you are, the less squares the fire can scatter to but still intersect with the alien.

Does this match up with other peoples experiences?

--Sfnhltb 12:59, 27 February 2007 (PST)


Hmm, I'm not sure what I'd say. In theory the "silhouette" wouldn't change much, if the angle were not a multiple of 45 degrees (that's what you mean, right?). I'm willing to bet that the engine is more influenced by things that might truncate values here and there, than anything else. And/or the interaction with exactly how they "draw" the "3D" target that the shot's trying to intersect. I'm sure it's crude but effective... but crude in what ways? shrug. - MikeTheRed 15:50, 28 February 2007 (PST)


Does the accuracy displayed in-game for the auto-fire apply to each individual shot or to all three shots?

It applies to each individual shot. -NKF 22:39, 1 December 2008 (CST)
Indeed. Note that the displayed "chance to hit" isn't really your chance to hit... It's more a measurement of the ranges of angles you can fire along. - Bomb Bloke 00:37, 2 December 2008 (CST)
In Laser Squad Nemesis, that is explicit - units have a stat called "inaccuracy", defined as "The average deviation from true for a weapon shot, in degrees." Has anyone made tests in X-Com, what is the relation of distance to target and displayed and actual chance to hit? - Quantifier 05:14, 2 December 2008 (CST)
Yes, this has been done. Arrow Quivershaft 08:49, 2 December 2008 (CST)
As in "spread" of your shots, BB? Where bigger spread means, less accurate? -MikeTheRed 04:15, 2 December 2008 (CST)

What, exactly, happens when you miss? Does the game shift your aim by pivoting around the fire point or actually pick a random location in 3D that's close'ish to the target? It seems to me like it's the latter due to your ability to miss and shoot the ground right at your feet when shooting at nearby aliens. This doesn't seem to happen for farther away targets. Would this then suggest that aiming behind your target could potentially result in more hits on target due to more "misses" hitting? I haven't tried this tactic in practice.

This is one of the unanswered questions, but the working hypothesis is that there is no specific hit/miss determination. That is, the game engine just fires the shot and introduces a random angular error. The maximum angular error is inversely proportional to the adjusted Chance to Hit. If the angular error is wide enough, the path of the shot no longer intersects the silhouette of the target defined by LOFTEMPS. Horizontal angular error seems to be greater than vertical angular error. But, most of this is conjecture. I was talking to Mike The Red about doing some histograms, analysing multiple shots with a wall of some vertical "destructible terrain" positioned behind a target. But we did not make any progress on that. Spike 14:13, 1 April 2011 (EDT)
Seb76 has obtained the firing point from the executable. I have a reverse-engineering of the horizontal angle the game pivots around the fire point (cf. User_talk:Bomb_Bloke:Firing_Accuracy), but I haven't been able to convince Bomb Bloke that it's completely correct. (We disagree on how my formula graphs. It does exactly match the extreme bounds by construction.) I am getting empirically correct predictions in-game combining my horizontal accuracy formula with Blind_Spots_From_First_Principles. It's very nice being able to directly calculate the best possible ambush locations in a landed Supply ship :) Zaimoni 23:51, April 1, 2011 (CDT)

Height?

I've been testing a new terrain which has several 2 and 3 level buildings and one thing that I am noticing is that accuracy seems to be affected by differences in height. The terrain allows for long range gunfights between different heights and it has become common to see my elite soldiers hitting nearly all targets at the same height but missing close to half while firing at a different height. Hobbes 17:28, 28 February 2012 (EST)

Units seem to have better accuracy vertically then they do horizontally, but as you get higher and higher above your target, their profile effectively gets smaller (eg, if you're directly above someone, all you're shooting at is their head).
Though there may be more to it then this. Kneeling when standing directly next to an alien (forcing them to fire downwards at you) dramatically increases your life expectancy, way more then you'd expect it to. In fact kneeling increases the odds so dramatically in your favour that you could just about believe there's a bug in the firing engine somewhere.
Shots are weighted (according to a bellcurve) so that they'll typically be closer to what you're shooting at, on average, then they could be. At 0% accuracy, you "can" fire anywhere up to half a radian to either the left or the right of the target - at 100%, you're still not guaranteed a hit, but you will never miss by MUCH (dunno what percentage you need to achieve "perfect" accuracy). This is why rookies are more likely to hit other team members then veterans are - because even if a vet misses, odds are his firing line is going to be closer to the alien then that of a rookie, so he has less chance of hitting anything that isn't directly between him and the target.
from the code: there seems to be two type of "misses", 1) a big miss, when the soldier completely misses against the odds displayed in the shooting menu, the bullet has high dispersion factor, and a 2) close shot, when the odds put the bullet just on target (close RNG call), there is a small extra divergence factor. So the rookies, obviously, get more of the first type. The first type of miss is probably responsible for the unreal "close miss" 1 or 2 tiles away. --kyrub 16:13, 1 March 2012 (EST)
I see you posted a formula regarding this on my accuracy testing page a few months back - I missed it then, but am looking at it with great interest now!
It never excludes accuracy from the equation entirely (as you're suggesting in your above post), but assuming "dispersion factor" represents the maximum angle a unit can shoot at, then a DF of 150 (only possible to roll with 0 accuracy) would mean that the actual shot COULD go anywhere within a radian spread, while a DF of 0 (achievable whenever x plus ten happens to be equal to accuracy) should always hit dead-on (a one-in-a-hundred chance of this happening, assuming accuracy is between 10 to 110 - otherwise, it can't).
There would have to be another roll after this to get the actual angle, but even a simple one would be enough to generate some degree of curve to the average shot angle observed in game. I wrote a proggy to generate a few thousand angles by first rolling a DF based on an accuracy of 0, then randomly selecting an angle from a range of DF divided by 150 times a radian, and got a graph that seems to exactly match the curve I obtained empirically! VERY happy to see that, though it may not hold up for other FAs (will have to do more testing tomorrow).
I guess there's another roll to get the vertical deviation in addition to the horizontal one, but I dunno what the max vertical firing angle is yet. And going by what Hobbes is saying, it may be that that roll is further affected by the height difference between units... -  Bomb Bloke (Talk/Contribs) 07:19, 2 March 2012 (EST)
But I digress. Vertically speaking, the angle range is much lower (though I haven't measured that one precisely yet - I just know it's smaller), but it may be that the same "weighting" isn't performed. This'd make height deviations much more important then they'd first appear as shot deviations would be less predictable. -  Bomb Bloke (Talk/Contribs) 09:14, 1 March 2012 (EST)
I should have mentioned that the shooting at buildings usually involves targets at both different vertical and horizontal levels. And it gets really weird to see because you have a soldier with 90 to 100 Firing Accuracy and its shots come as if he has only half the accuracy. Hobbes 14:24, 1 March 2012 (EST)
So you're saying the shots go a lot wider if the target isn't on the same level? It may indeed be that the effective accuracy of a soldier does indeed get a penalty in that scenario, if that's the case. Are you talking left/right angles or up/down ones? -  Bomb Bloke (Talk/Contribs) 07:19, 2 March 2012 (EST)
Not sure what you mean by left/right up/down angles. Usually the situation is a soldier at ground level firing at a distance of 7 tiles or more to an alien located on the 1st or 2nd level, either to the left or to the right, of the soldier. You see this also happening while firing from the top of the Skyranger ramp. Hobbes 07:29, 2 March 2012 (EST)
What I'm getting at is that the lower your accuracy, the wider your shots can go. A soldier with 100 accuracy will, if he misses, hit a tile very close to the target - if he were firing "as if he has only half the accuracy", then he can miss by quite a bit more. A soldier with VERY low accuracy may fire on such a bad angle that he actually has to turn in order to make the shot (I guess this happens whenever his selected firing line is more then 22.5 degrees away from the target, given that the eight different directions he can face divides into 360 degrees 45 times). Though you have to have somewhat less then 50 accuracy to even have a chance of firing that badly.
Though I realise this isn't strictly common knowledge, so that may not be what you meant.
To rephrase the question: When your soldiers miss, have you been able to spot whether the bullet usually goes to the left or right of the alien (that is to say, is the horizontal angle off), or does it usually line up horizontally but miss vertically (in which case the bullet would end up hitting directly above/below the target)? Or both? -  Bomb Bloke (Talk/Contribs) 08:16, 2 March 2012 (EST)
Got it now, thanks. The answer to your last question is both - when they miss the shot can go stray either horizontal or vertical or both. Another thing that I've remembered is that flying units also seem to suffer from an accuracy penalty when firing on the air, so I think that there's definitely a height factor involved in the calculation for a shot to hit or miss.Hobbes 09:57, 2 March 2012 (EST)