XCOM: Enemy Unknown

XCOM: Enemy Unknown

View Stats:
Behind the scenes: hit probability calculation
I know this series has infuriated people to no end about its hit percentages seemingly lying. One point that hasn't been fully explored is how the pseudo-random number generator is actually being used.

A typical generator function is this: value = ((seed * prime) + addend) MOD highest.

Since probabilities are normally calculated as "1 in N" this means the value returned by the function is MODded further, by N. Since the value, which is fed into the next seed, usually ends up being far greater than N, the result will be "random enough" for most people.

EXCEPT...sometimes, it isn't. You might have heard about the concept of "cryptanalytic weaknesses" when given some combinations of primes, addends, and seeds? There are, theoretically, some seeds that might consistently result in patterns that statistically favor low values, high values, or even multiples of lower primes when MODded.

I've seen the rare results of "bad seeds" with Ikari Warriors on C64. Sometimes, you simply stop getting ammunition powerups--full stop--midway through the game. It would appear the random number function is somehow "trapped" in a cycle of unfavorable results, but it only happens if the original seed chosen (and the other values of the function) permit this.

Do I believe the XCOM devteam allowed this type of trap on purpose? Absolutely not. But if it is the reason, it would explain the glaringly different experiences people have had, with the game seeming quite fair for some and very unfair for others.
< >
Showing 1-15 of 39 comments
Messsucher Sep 10, 2017 @ 7:39am 
I think those who have not much experience of strategy gaming think it is RNG what sucks. Strategy gaming is risk management.
Messsucher Sep 10, 2017 @ 9:03am 
If you put your team in a situation where two 70% shots misses, and it was critical for you them to hit, then you should go right away back to wash dishes in some rural small restaurant – because by all means that is the place you belong instead of commanding a squad of soldiers.
Baby_Cookie[WOLF] Sep 10, 2017 @ 9:03am 
but what if they made it easy and honest and pure luck ? :p

the game takes all solid numbers and calculates "final aim" - getting the overview of things you can see it do that

default aim - cover reduction - statreduction on alien + elevated position of player + boosted stat on player + ..... = final aim

it's pretty straight forward stuff

( as example : have a soldier with 70 aim stand right in front of a levitating floater and the game will claim you have 50% chance to hit... 70 from soldier - 20 from floater "loating defense boost" ( a skill floaters have )

-----------------------------

all it then has to do is effectively apply an rng fucntion
( as simple as scientific calculators come prepacked with a rnd(...,...) funciton )

let that rnd function choose any number between 1 - 100
( aka rnd ( 1 , 100 ) = 65 ( let's say ))

------------------------------

after that all the game has to do is crossreference it's rnd number with the designated zones form final aim

( i delibiratly chose 50 here cause that's what people get upset about :p )
the zones would be
1-50 = miss
51-100 = hit

65 as the random number is within the hit zone so you hit your target

it's simple, it's easy and it's deadhonest luckwise

....
improve the amuont of numlber on the rnd-- 1 -10 000 let's say and it gets even more honest
have the game then wipe it's own memory after each rnd function to not be able to keep track of it

and you have a game designed purely on luck
( however they don't wipe memory as the game can force "luck" on easy and normal as well as force "bad luck" )

------------------------------------

this ofcourse has nothing to do with actual damageoutpus


or basically ( as it should be )
GET AIM UP HIGH by decent positioning and tactical planning
95 % = 95 numbers for you to actually hit
BUT ALSO "5" TO MISS - so it doesn't guarantee anything at any time :p

and then just get lucky
( a factor of luck in games like these can only be a good thing honestly :p )
( otherwise you'd just set the door wide open for engine abuse if it's all hardcoded calculations )


maybe this is to simple ( probably )
but i would do it as simple like that, there isn't anything more honest then this
no matter how hard you try, you just can't force the outcome of an rnd function you have no acces to :p

-------------

edit : reading yours again
i feel like i said about the same thing, but yours sounds like it's on a way more appropriate level :p

"Since probabilities are normally calculated as "1 in N" this means the value returned by the function is MODded further, by N. Since the value, which is fed into the next seed, usually ends up being far greater than N, the result will be "random enough" for most people."

would be a higher educated version of me saying the game keeps memory of it's rolls, no ?
Last edited by Baby_Cookie[WOLF]; Sep 10, 2017 @ 9:10am
Nefrogitis Sep 10, 2017 @ 11:46am 
What they should have done is to make shots that are 76% and greater always connect, and the shots lower than 76% to 50% depend on luck, and the ones below 50% almost always whiff. That would have been a better system than the one they have in place right now.
I mean to miss a 95% shot is ridiculous, unless there is a very strong reason behind such a miss, like say a bright light just flashed the moment you took the shot.
Baby_Cookie[WOLF] Sep 10, 2017 @ 12:10pm 
Originally posted by Nefrogitis:
What they should have done is to make shots that are 76% and greater always connect, and the shots lower than 76% to 50% depend on luck, and the ones below 50% almost always whiff. That would have been a better system than the one they have in place right now.
I mean to miss a 95% shot is ridiculous, unless there is a very strong reason behind such a miss, like say a bright light just flashed the moment you took the shot.

a mosquito

ever tried to focus and then that small thing comes up right next to your ear with it's highpitched bzzzzzzzzzzz

i swear, those things could even make an autoaim miss :p

( come to think of it.. imagine a silent mosquite Ö - it'd be the deadliest thing in existence... at least now they give themselves away before they strike :p )
-----------
other then that..
life doesn't have perfection
perfection is unatainable
....
it's for the better, perfection would be boring :3
Last edited by Baby_Cookie[WOLF]; Sep 10, 2017 @ 12:14pm
RJJameson Sep 10, 2017 @ 12:21pm 
Originally posted by Nefrogitis:
What they should have done is to make shots that are 76% and greater always connect, and the shots lower than 76% to 50% depend on luck, and the ones below 50% almost always whiff. That would have been a better system than the one they have in place right now.
I mean to miss a 95% shot is ridiculous, unless there is a very strong reason behind such a miss, like say a bright light just flashed the moment you took the shot.
O.o
Snarplord XVI Sep 10, 2017 @ 1:13pm 
Originally posted by Nefrogitis:
What they should have done is to make shots that are 76% and greater always connect, and the shots lower than 76% to 50% depend on luck, and the ones below 50% almost always whiff. That would have been a better system than the one they have in place right now.
I mean to miss a 95% shot is ridiculous, unless there is a very strong reason behind such a miss, like say a bright light just flashed the moment you took the shot.
Yeah, what they should have done is make the random numbers not random at all!
Lord Bowser Sep 10, 2017 @ 1:40pm 
Originally posted by Baby_Cookie WOLF:
it's for the better, perfection would be boring :3

Exactly. You should always be able to roll a 1 on your d20. Which, as it turns out, is exactly equivalent to missing a 95% shot. Max level characters should always be able to slip up, otherwise the late game would have little to no risk or challenge.
Originally posted by Lord Bowser:
Originally posted by Baby_Cookie WOLF:
it's for the better, perfection would be boring :3

Exactly. You should always be able to roll a 1 on your d20. Which, as it turns out, is exactly equivalent to missing a 95% shot. Max level characters should always be able to slip up, otherwise the late game would have little to no risk or challenge.
late game already have little to no rick challenge XD
red255 Sep 10, 2017 @ 7:31pm 
Originally posted by Messsucher:
If you put your team in a situation where two 70% shots misses, and it was critical for you them to hit, then you should go right away back to wash dishes in some rural small restaurant – because by all means that is the place you belong instead of commanding a squad of soldiers.

Critical for One Or Both of them to hit?

In month 1 council mission you can encounter thin men.

you need them to die or they'll take shots at you. 4HP on classic, so can't be easily grenaded, might be out of range of rockets.

Taking the shot reduces the chance that the thin man kills one of your squad by 70%. Not the greatest situation, but still tactically a better choice than not taking the shot.
DecayWolf Sep 11, 2017 @ 12:17am 
I think missing a 98 or 99% is not a problem. The problem comes when I miss a 98%, following by a 80%+ following by 70% and then two 56% all in the same target which the cover was destroyed.

Or maybe a rapid fire with 96% where both shots miss.
Or any kind of chain that you miss a couple of 80 - 90% shots (which happens more often that possibility should ever allow)

Missing a 99% shot, I am fine with that, even if that result killing on of my hard veteran col.
But missing a couple of high chance shots? Nah, BS.
Messsucher Sep 11, 2017 @ 12:51am 
Originally posted by red255:
Originally posted by Messsucher:
If you put your team in a situation where two 70% shots misses, and it was critical for you them to hit, then you should go right away back to wash dishes in some rural small restaurant – because by all means that is the place you belong instead of commanding a squad of soldiers.

Critical for One Or Both of them to hit?

In month 1 council mission you can encounter thin men.

you need them to die or they'll take shots at you. 4HP on classic, so can't be easily grenaded, might be out of range of rockets.

Taking the shot reduces the chance that the thin man kills one of your squad by 70%. Not the greatest situation, but still tactically a better choice than not taking the shot.

Well, if it is not a bomb mission you can deal with them by using ambush tactics, a much underrated tactic because people don't consider it being "aggressive".

If it is a bomb mission you better just retreat after the first gambling shots fail. You lose the gamble, and soon you lose all your men. I know it is hard to abandon a mission. That is the toughest choice to make. However, a good commander can make tough decisions.
RifqyDgamer Sep 11, 2017 @ 1:37am 
80% isnt the chance for you to hit
its the chance for you to get dissapointed when it misses
Timbermaw Sep 11, 2017 @ 1:52am 
Originally posted by RifqyDgamer:
80% isnt the chance for you to hit
its the chance for you to get dissapointed when it misses
:steamsad:
szmind Sep 11, 2017 @ 2:01am 
Originally posted by RifqyDgamer:
80% isnt the chance for you to hit
its the chance for you to get dissapointed when it misses
The best summary of all the probability discussion ever :)
< >
Showing 1-15 of 39 comments
Per page: 1530 50

Date Posted: Sep 10, 2017 @ 6:31am
Posts: 39