Jump to content

Talk:Chance to Hit (EU2012): Difference between revisions

From UFOpaedia
No edit summary
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
A few messy late-night notes whilst I work out in me own mind how this here accuracy system works.
===Archiving===
I'm clearing this talk page off as it otherwise consisted of my (very messy, wall-o-text) "notes to self" about the range formulas. The old version can be found [http://www.ufopaedia.org/index.php?title=Talk:Attack_%28EU2012%29&oldid=43889 here]. Just for quick reference, [[User:Hobbes|Hobbes]] had linked me to this [http://forums.2kgames.com/showthread.php?194691-Guide-Basic-Math-thread this thread], which contains a lot of excellent information that should be incorporated into the wiki sooner or later. - <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 04:03, 17 January 2013 (EST)


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.
===Merge===
So as I planned out [[Talk:Gameplay_Mechanics_(EU2012)#Restructuring|over here]], I've incorporated everything to do with attack, defence, and accuracy in general and plonked it into one page. So now I've gone and wiped the [http://www.ufopaedia.org/index.php?title=Defense_%28EU2012%29&oldid=42323 old defence article]. I don't believe there's anything on that that isn't covered in this new one, but on the off-chance that anyone spots something of importance there, please go ahead and bring it over. - <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 01:37, 30 January 2013 (EST)


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%.
==="When The Game Cheats..." section out of date, or inapplicable to EW?===
Are we certain this applies to XCOM: Enemy Within? I'm fairly certain I've missed 90% shots, on normal, with four squaddies. [[User:PocketNerd|PocketNerd]] 23:17, 28 December 2013 (EST)
:Well I've missed 100% shots on Classic or Impossible. [[User:Hobbes|Hobbes]] ([[User talk:Hobbes|talk]]) 09:42, 29 December 2013 (EST)


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...
::Probability is a fickle mistress. [[User:Arrow Quivershaft|Arrow Quivershaft]] ([[User talk:Arrow Quivershaft|talk]]) 12:34, 29 December 2013 (EST)


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.
:::I do understand probability. (It's annoying to miss two 95% shots in a row, but considering it's a 1 in 400 chance and you take ''thousands'' of shots in XCOM, it does happen!) Still, the section says "if you have four soldiers or less in play... if you see 84% or above, the shot should always hit." That's demonstrably not true any more, at least not for EW. I'm thinking the section may need to be rewritten, although I'm not sure how to do so without just deleting a lot of information (and possibly looking like vandalism). Maybe, for now, just add a statement that the PA forum post is a year old, far antedating EW, and does not seem to apply to EW? (And can anybody verify whether it still applies to the current build of EU?) [[User:PocketNerd|PocketNerd]] ([[User talk:PocketNerd|talk]]) 11:56, 2 January 2014 (EST)


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.
::::I'm not quite sure what Bomb Bloke was actually trying to write when he wrote that so I'm going to hide it until someone can make some sense out of it. --[[User:Ditto51|Ditto51]] ([[User talk:Ditto51|talk]]) 12:06, 2 January 2014 (EST)
 
:::::As far as it is known the Bonus for Easy/Normal hasn't been changed, since that would have a major effect on the game difficulty. Unless there's a specific reference online that it has been changed, all of the current info still points for it still being in place. [[User:Hobbes|Hobbes]] ([[User talk:Hobbes|talk]]) 16:47, 2 January 2014 (EST)
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.
::::::I've been playing around with a single soldier campaign on easy difficulty and I'm pretty sure that the huge bonuses mentioned in the article (+75% defense, +45% aim) do not apply. It's possible that they only get added when you start losing soldiers and drop below 4, but if you start out with one soldier you don't get these. --[[User:DerAva|DerAva]] ([[User talk:DerAva|talk]]) 05:47, 1 April 2014 (EDT)
 
:::::::Yeah, just checked the CalculatedOdds function in the game code and it has a variable called GetNumAliveAndWell when checking for the number of soldiers in the squad. I can't find out that what that function checks exactly but from the name and your report it would seem logical that the bonuses only apply after you started taking casualties. Also, it would be very easy to get the Lone Wolf achievement by only bringing 1 soldier on Easy. I'll change the page text. [[User:Hobbes|Hobbes]] ([[User talk:Hobbes|talk]]) 11:30, 1 April 2014 (EDT)
A few logged bonuses at different ranges on a flat surface:
 
{| class="wikitable"
!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.
 
- <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 09:10, 13 January 2013 (EST)
 
:BB, check this link on the Multiplayer section of the 2K forums: [[http://forums.2kgames.com/showthread.php?194691-Guide-Basic-Math-thread]]. 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. [[User:Hobbes|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
 
- <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 08:53, 14 January 2013 (EST)
 
Or it's 56 - 4 * int( 2 * root of (square of x range + square of y range) / root(2) ). What with the common factor of 4 and all. Duh.
 
56 - 4 * int( 2 * root(1^2 + 0^2) / root(2) ) = 56 - 4 * int( 2 * 1 / root(2) ) = 56 - 4 * int( 2 / root(2) ) = 56 - 4 * int( 1.42 ) = 56 - 4 = 52
 
56 - 4 * int( 2 * root(2^2 + 0^2) / root(2) ) = 56 - 4 * int( 2 * 2 / root(2) ) = 56 - 4 * int( 4 / root(2) ) = 56 - 4 * int( 2.82 ) = 56 - 8 = 48
 
56 - 4 * int( 2 * root(3^2 + 0^2) / root(2) ) = 56 - 4 * int( 2 * 3 / root(2) ) = 56 - 4 * int( 6 / root(2) ) = 56 - 4 * int( 4.24 ) = 56 - 16 = 40
 
56 - 4 * int( 2 * root(4^2 + 0^2) / root(2) ) = 56 - 4 * int( 2 * 4 / root(2) ) = 56 - 4 * int( 8 / root(2) ) = 56 - 4 * int( 5.66 ) = 56 - 20 = 36 (Matches the Google docs spreadsheet, but not my observed results!)
 
56 - 4 * int( 2 * root(5^2 + 0^2) / root(2) ) = 56 - 4 * int( 2 * 5 / root(2) ) = 56 - 4 * int( 10 / root(2) ) = 56 - 4 * int( 7.07 ) = 56 - 28 = 28
 
So yeah that's shotguns.
 
With most range 27 weapons at a range of two tiles, the spreadsheet indicates a range bonus of 33. I got 32. Why? Tests reveal it's because of the ''direction''. Without spamming more example calculations showing why, that means the base bonus along one axis is a very nice round 42, but along the other it's 41.6. For some reason. Presumably something similar is going on with shotguns (which means you can get a +4% bonus at certain ranges depending on which direction you approach), but I'll have to scratch my head a little bit as to where to stick the relevant number. My first guess is it's a +0.4 bonus to whatever value is to be rounded down before multiplying by 4. I'd need a whole bunch more logged results to be certain. Bah. Wish I could copy'n'paste units around the board like I can for the old game...
 
And laser/alloy shotguns are probably the same formula but maybe a different range bonus. Something higher then 56 probably, again that'll require more logs. The results should make it possible to work out what "range 27" actually ''means'' though, so those numbers should be the most interesting.
 
Anyway. Snipers!
 
-27.5 + root(square of x range + square of y range) * 2 * root(2), ignore the bonus if it goes positive.
 
This works pretty well but there's enough jitter to suggest that direction adds a bonus in there somewhere too.
 
- <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 07:20, 15 January 2013 (EST)
 
:I've had the discussion on the 2K forums before of how to translate the game values (weapon range, movement) into reality, ie, how much tiles is 27 or 12. From the tactical battles 27 should correspond to 17 tiles (the sight limit for your units) and the 12 to either 7 tiles or 15 (depends if dashing is included. One value that comes from here is that it costs 1.6 to move 1 tile horizontally or vertically. If you apply that 1.6 constant per tile to firing then 27 = 16.875 tiles, which also fits the battle results.
:The game files also have the termination 'ft' for some range numbers so the numbers can merely be feet. [[User:Hobbes|Hobbes]] 07:38, 15 January 2013 (EST)
 
That'd about make sense, but pulling some figures for alloy shotguns (range 27), I find them exactly the same as the regular version... which has a range of 10. And can fire right up to about the sight range limit. That is to say, it appears weapon "range" has absolutely nothing to do with anything... Except reaction fire, maybe, though the weapons page already ''shows'' a separate field for "reaction range". And then there's "reaction angle".... I get the impression those numbers are simply unused remnants of scrapped features.
 
Ah well! Saves a bit of time I suppose in that I don't have to try and factor it into the equations, which are probably about as complete as they need to be (short of someone pulling the exact coding out of the executable). Or maybe the figures on the weapons page are just plain wrong, I dunno. - <span style="font-size:xx-small">&nbsp;[[User:Bomb_Bloke|Bomb Bloke]] ([[User_talk:Bomb_Bloke|Talk]]/[[Special:Contributions/Bomb_Bloke|Contribs]])</span> 07:44, 16 January 2013 (EST)

Latest revision as of 15:30, 1 April 2014

Archiving

I'm clearing this talk page off as it otherwise consisted of my (very messy, wall-o-text) "notes to self" about the range formulas. The old version can be found here. Just for quick reference, Hobbes had linked me to this this thread, which contains a lot of excellent information that should be incorporated into the wiki sooner or later. -  Bomb Bloke (Talk/Contribs) 04:03, 17 January 2013 (EST)

Merge

So as I planned out over here, I've incorporated everything to do with attack, defence, and accuracy in general and plonked it into one page. So now I've gone and wiped the old defence article. I don't believe there's anything on that that isn't covered in this new one, but on the off-chance that anyone spots something of importance there, please go ahead and bring it over. -  Bomb Bloke (Talk/Contribs) 01:37, 30 January 2013 (EST)

"When The Game Cheats..." section out of date, or inapplicable to EW?

Are we certain this applies to XCOM: Enemy Within? I'm fairly certain I've missed 90% shots, on normal, with four squaddies. PocketNerd 23:17, 28 December 2013 (EST)

Well I've missed 100% shots on Classic or Impossible. Hobbes (talk) 09:42, 29 December 2013 (EST)
Probability is a fickle mistress. Arrow Quivershaft (talk) 12:34, 29 December 2013 (EST)
I do understand probability. (It's annoying to miss two 95% shots in a row, but considering it's a 1 in 400 chance and you take thousands of shots in XCOM, it does happen!) Still, the section says "if you have four soldiers or less in play... if you see 84% or above, the shot should always hit." That's demonstrably not true any more, at least not for EW. I'm thinking the section may need to be rewritten, although I'm not sure how to do so without just deleting a lot of information (and possibly looking like vandalism). Maybe, for now, just add a statement that the PA forum post is a year old, far antedating EW, and does not seem to apply to EW? (And can anybody verify whether it still applies to the current build of EU?) PocketNerd (talk) 11:56, 2 January 2014 (EST)
I'm not quite sure what Bomb Bloke was actually trying to write when he wrote that so I'm going to hide it until someone can make some sense out of it. --Ditto51 (talk) 12:06, 2 January 2014 (EST)
As far as it is known the Bonus for Easy/Normal hasn't been changed, since that would have a major effect on the game difficulty. Unless there's a specific reference online that it has been changed, all of the current info still points for it still being in place. Hobbes (talk) 16:47, 2 January 2014 (EST)
I've been playing around with a single soldier campaign on easy difficulty and I'm pretty sure that the huge bonuses mentioned in the article (+75% defense, +45% aim) do not apply. It's possible that they only get added when you start losing soldiers and drop below 4, but if you start out with one soldier you don't get these. --DerAva (talk) 05:47, 1 April 2014 (EDT)
Yeah, just checked the CalculatedOdds function in the game code and it has a variable called GetNumAliveAndWell when checking for the number of soldiers in the squad. I can't find out that what that function checks exactly but from the name and your report it would seem logical that the bonuses only apply after you started taking casualties. Also, it would be very easy to get the Lone Wolf achievement by only bringing 1 soldier on Easy. I'll change the page text. Hobbes (talk) 11:30, 1 April 2014 (EDT)