Jump to content

Talk:Chance to Hit (EU2012)

From UFOpaedia
Revision as of 13:53, 14 January 2013 by Bomb Bloke (talk | contribs)

A few messy late-night notes whilst I work out in me own mind how this here accuracy system works.

Most guns seem to have the same figures as far as accuracy goes. See how on the Weapons_(EU2012) page just about all of them have the same range of 27? Yeah, that means they get the same accuracy bonuses. Haven't checked the laser/alloy shotguns yet but a vanilla pistol has the same accuracy as a heavy plasma for eg.

Bonuses like the light plasma's 10% aim chance are tacked onto the final score. So if a heavy plasma has a 65% chance to hit after adding all bonuses and minusing all penalties, the the lpr would've got 75%.

Crit chance has nothing to do with chance to hit. A shotgun is as likely to crit at near or far range (assuming it can actually hit something), which is a bit unintuitive when you consider how a real shotgun works...

The pistol foundry crit chance upgrade shows up in the geoscape when viewing weapon info as being 20%. In battle, it doesn't show up at all.

The pistol foundry aim chance upgrade shows as 10% in the battlescape, but doesn't show in the geoscape. The scope crit upgrade doesn't appear to work at all.

Do alien defense bonuses show up prior to researching them? Would hope so, otherwise the displayed shot percents are messed up... Which they are for normal/easy mode anyways, apparently you get a hidden bonus on those modes which gets larger with each consecutive miss you make.

A few logged bonuses at different ranges on a flat surface:

Weapon Range Type Crit Angle 0 1 2 3 4 5
Pistol Medium (27) 0 Straight 41 37 32 28 23
Pistol Medium (27) 0 Diagonal 41 35 28 22 16 9
Shotgun Short (10) 20 Straight 56 52 44 40 32
Shotgun Short (10) 20 Diagonal 56 48 40 32 24 16

(Range 0 acquired by placing a trooper where a thinman is scripted to drop, first Slingshot mission has such a position that's really easy to get to).

Thinking of it as a penalty system, you get something like -4.5 for every square you are away from the target, so eg max bonus of 41 - 4.5 = 36.5 (rounded up to 37), -4.5 = 32, -4.5 = 27.5 (rounded up to 28), etc. This bonus can't go negative, so once you move out of range to get it at all, your accuracy isn't really hindered by moving further back. Likewise, if you're too far back to get the bonus, if you don't move far enough forward you STILL won't get any bonus.

Figures suggest that Pythagoras is used to work out the distance as need be. So moving away on a diagonal line (one tile on each axis), multiply 4.5 by 1.4 (add the squares of one to each other to get two, then take the root of that), penalty becomes 6.3. 41 - 6.3 = 35.7 (should be 34.something), -6.3 = 29.4 (should be 27.something), -6.3 = 23.1 (should be 21.something), -6.3 = 16.8 (should be 15.something)... this suggests range 0 is really a 40.something bonus, not an exact 41. Probably 40.6 or somesuch.

Shotgun figures don't make a lot of sense moving along one axis, but diagonally (along two axises) it looks like just -8 each time. -5.7 along the straight then? Still doesn't add up, might've somehow mislogged. Shotgun gets a penalty at longer ranges. Not sure about other guns, you probably get out of range before that happens.

-  Bomb Bloke (Talk/Contribs) 09:10, 13 January 2013 (EST)

BB, check this link on the Multiplayer section of the 2K forums: [[1]]. There's also a link there to a Google Docs table where someone already did that math, I've been wanting to add that but I haven't had time yet. Hobbes 17:46, 13 January 2013 (EST)

Ah, that's awesome, thanks! Unfortunately it lacks the actual maths I'm after, but there's plenty of data to work with.

Very interesting that so many weapons have the same "range". For eg, the game reports the assault rifle is a "short" range weapon, but all other data seems to indicate it's the same as most of the other guns (which are flagged as "medium").

The guy also notes a "jitter" element affecting his logged stats, which I also picked up on one or two tests. It may be that distance is plotted from between the units - larger units being effectively "closer", so you may get a better range bonus when facing down a sectopod then you do a drone. Or maybe the game just fudges the numbers a little every now and then to try and hide the feeling that all troops are the same. Or maybe it has something to do with direction...

Anyway, thinking some more, the "bonus" for close range attacks with standard guns is probably rounded down, not up. This'd suggest that for most guns, the formula is something like:

41.6 - root(square of x range + square of y range) * 4.5

So for eg, if you're talking four squares away it's:

41.6 - root(4^2 + 0) * 4.5 = 41.6 - 4 * 4.5 = 41.6 - 18 = 23.6

Or diagonally at range five it's:

41.6 - root(5^2 + 5^2) * 4.5 = 41.6 - root(50) * 4.5 = 41.6 - ~7 * 4.5 = 41.6 - 31.8 = 9.7

Or diagonally at range two it's:

41.6 - root(2^2 + 2^2) * 4.5 = 41.6 - root(8) * 4.5 = 41.6 - ~2.8 * 4.5 = 41.6 - 12.7 = 28.9

Good enough!

For the shotgun, the maths seems to be (but isn't exactly) something like:

56 - int( 8 * root of (square of x range + square of y range) / root(2) ), and don't ignore the bonus if it goes negative.

(Though the base shotgun is the only gun with range 10, so as the laser/alloy versions have range 27, the formula is probably a little different again for them).

So at ranges 1 through to 5 it's:

56 - int( 8 * root(1^2 + 0^2) / root(2) ) = 56 - int( 8 * 1 / root(2) ) = 56 - int( 8 / root(2) ) = 56 - int( 5.65 ) = 56 - 5 = 51

56 - int( 8 * root(2^2 + 0^2) / root(2) ) = 56 - int( 8 * 2 / root(2) ) = 56 - int( 16 / root(2) ) = 56 - int( 11.31 ) = 56 - 11 = 45

56 - int( 8 * root(3^2 + 0^2) / root(2) ) = 56 - int( 8 * 3 / root(2) ) = 56 - int( 24 / root(2) ) = 56 - int( 16.97 ) = 56 - 16 = 40

56 - int( 8 * root(4^2 + 0^2) / root(2) ) = 56 - int( 8 * 4 / root(2) ) = 56 - int( 32 / root(2) ) = 56 - int( 22.62 ) = 56 - 22 = 34

56 - int( 8 * root(5^2 + 0^2) / root(2) ) = 56 - int( 8 * 5 / root(2) ) = 56 - int( 40 / root(2) ) = 56 - int( 28.28 ) = 56 - 28 = 28

Yeah, something like that. Will have to scratch my head a bit more as it's usually 1-2% off. May be "eight and a bit" instead of just eight. Will want to log more values on the diagonal to be sure.

1 to 5 on the diagonal does look pretty clear with the few values I have though:

56 - int( 8 * root(1^2 + 1^2) / root(2) ) = 56 - int( 8 * root(2) / root(2) ) = 56 - 8 * 1 = 56 - 8 = 48

56 - int( 8 * root(2^2 + 2^2) / root(2) ) = 56 - int( 8 * root(8) / root(2) ) = 56 - 8 * 2 = 56 - 16 = 40

56 - int( 8 * root(3^2 + 3^2) / root(2) ) = 56 - int( 8 * root(18) / root(2) ) = 56 - 8 * 3 = 56 - 24 = 32

56 - int( 8 * root(4^2 + 4^2) / root(2) ) = 56 - int( 8 * root(32) / root(2) ) = 56 - 8 * 4 = 56 - 32 = 24

56 - int( 8 * root(5^2 + 5^2) / root(2) ) = 56 - int( 8 * root(50) / root(2) ) = 56 - 8 * 5 = 56 - 40 = 16

-  Bomb Bloke (Talk/Contribs) 08:53, 14 January 2013 (EST)