Chance to Hit (EU2012)
Aim (or Attack) is the base statistic each unit has which accounts for the bulk of its accuracy in battle. For XCOM soldiers, this goes up at a set rate based on rank and class, whereas for aliens it's determined by their race and the difficulty level.
Defence, on the other hand, is the statistic which lowers each unit's chance to be hit. Your units may improve their base defence stat pre-battle by donning certain forms of armour (keeping in mind that most only grant additional health points, lessening the effects of damage, rather then your chance to avoid it altogether). Some alien races have an innate defensive bonus which is increased on higher difficulties.
Just before OK'ing a shot on your target, you may select "More Info" within the game's HUD to see a list of which modifiers would apply to it.
Chance to Hit Calculation
The actual formula  seems to be:
Aim (unit stat + modifiers) - Defence (unit stat + modifiers) = total (clamped to 1%, if negative) + range modifier = final result
This formula explains the oddities of when units get hit while hunkered down in full cover, since it is impossible to completely miss a shot due to the clamp. The later addition of the range bonus after the aim/defence values are calculated also makes it more likely to get a hit, if the shooter is close to the target.
A typical XCOM rookie starts off with a flat 65 Aim stat. Generally, as their rank improves, they gain additional points at a static rate (that is to say, a Lieutenant Sniper will always have an Aim stat of 84). Second Wave options can instead be used to mix up the abilities of your ranks - "Not Created Equally" has them start with an aim stat of somewhere from 55 to 80, whereas "Hidden Potential" randomises their gains.
The DLC unit Shaojie Zhang has an extra +5 Aim relative to other non-Second Wave affected heavies. Heroes may also exceed the norm (Ken Levine in particular clocks in with a massive score of 200, nearly double the usual potential of his sniper class!).
In addition to their base stats, each class may choose from a variety of perks which can potentially improve accuracy, decrease it in exchange for another bonus, raise their defence, or affect the aim/defence values of other units in play:
|The Assault class sports moderate accuracy, but their shotguns grant huge bonuses at near range - and they're very good at closing the distance. At distances further then ten tiles, their pistols (or perhaps rifles, if equipped) make for more reliable damage, albeit somewhat reduced in power. They can acquire abilities that improve their defence when up in the alien's faces.
|Heavies have very poor aim compared to other classes, but make up for it with a number of abilities which ignore the stat, and at close range their accuracy improves somewhat. Their rockets always have at least a 90% chance to strike their targets, and having them open up on your enemies first can often result in them destroying alien cover or granting other accuracy benefits to their squad-mates (whether the heavies themselves manage to hit or not).
|Snipers gain no accuracy bonuses from their high-powered rifles, and in fact take a penalty if they try to use them at close range (pistols have a better chance to hit at distances less then ten tiles). However, their innate accuracy stats are through the roof, and optional abilities at higher ranks may push them even higher.
|Supports are very "mid-range" in terms of accuracy, and their potential damage output isn't anything to brag about in comparison to other classes. It should be noted that regardless of range, the rifles and pistols available to them will typically each have the same chance to hit as the other (excluding any weapon-specific bonuses, such as that available to the Light Plasma Rifle or Foundry-upgraded pistols). Their smoke grenades can grant defence bonuses to units they cover.
Aliens are, for the most part, about on par with lower-ranked XCOM soldiers, though on difficulty levels above normal they receive a +10 aim/crit bonus (and an extra +10 aim for Outsiders and Muton Elites on Impossible).
Many aliens have innate defensive bonuses, which XCOM solders require certain forms of armour to acquire.
Whilst some aliens wield the Light Plasma Rifle seen earlier on in the game (especially favoured by Thin Men) which, in XCOM hands confers an additional +10 bonus to its wielder, this does not apply to aliens. Those aliens which use melee attacks (the Chryssalid, the Zombie, and the Muton Berserker) never miss.
|Heavy Floater||70||10||Muton Elite||80||20|
* These units may not use cover for further defensive bonuses.
** These units may not use cover for further defensive bonuses, but do however gain extra defense while in flight.
Of all the guns you may equip, only one offers improved accuracy over others of its kind - the Light Plasma Rifle, which adds +10% to any shots made with it. However, each class of weapon - shotguns, snipers, or "other" - handles accuracy differently depending on range.
The main item to turn to when looking for a little extra reliability is the S.C.O.P.E., which grants +10% aim to the primary weapon (and, with the right upgrade, +10% crit chance). Heavies in particular find this useful (due to their low base aim), but it's a solid choice for most any unit.
The Arc Thrower is notable in that it's not considered a weapon, and uses entirely different aiming mechanics - its chance to hit depends only on the health of the target. Explosive weapons are another exception, in that they always hit everything within their blast radius - for those, a "miss" constitutes somehow firing them in an entirely different direction to where they were aimed.
Conversely, some forms of armor can allow you to raise your defence, reducing the chance of alien shots landing. While all types grant additional hit points, Skeleton Suits and Psi Armour grant +10% defence to the wearer at all times, whilst Ghost Armor gives +20% even without cloaking.
In fact, when you consider that Skeleton Suits also grant additional movement points and the grapple - and are actually cheaper to produce than Carapace Armour - they may be the better choice for your units regardless of class. Its one deficit is a single less hit point.
Contrary to its item description, Archangel Armour does grant bonuses to units in the air. Taking to the air above your opponents grants the usual +20% aim height bonus against them, but also grants low cover bonus (+20% defence) from the armor's Evasion ability while in flight (same as with Floaters and other alien flying units), and for Snipers, also triggers the Damn Good Ground perk - granting an additional +10% aim/defence. Airborne snipers can almost ignore enemies' high cover.
An aim bonus may be granted based on the distance to the target, depending on the type of weapon used. For the purposes of determining this bonus, guns always fall into one of three different categories: shotguns, sniper rifles, or "everything else".
Most - from the humble Pistol through to the legendary Heavy Plasma - are treated the same in terms of accuracy. Have two soldiers at the same distance from your target, each'll get the same range bonus as the other. Such weapons may only receive range bonuses - if you're too far away to receive one (ten tiles or more), then there's no penalty.
The rifles used by Snipers, on the other hand, are the reverse: being closer then ten tiles inflicts a penalty, and moving further away simply lessons this until it goes away completely.
The only weapon type that has access to a range bonus in addition to a penalty is the shotgun class used by Assaults. A distance of less then ten tiles sees their accuracy spike up quickly; but a distance further then ten tiles inflicts a penalty at the same rate (though oddly enough, no such penalty applies to their damage - if they happen to hit at long range, they'll be just as devastating as a point-blank blast to the face).
The following formulas describe accuracy drop-off. Again, note that if the standard weapon bonus drops below 0, it's ignored, if the sniper penalty rises above 0 it's ignored, and the shotgun formula always applies. x and y describe the distance in tiles along each axis between the target and the shooter (i.e. Pythagoras is used to get the proper distance on any angle, so ten tiles in a straight line are about equal in distance to seven along a 45° angle). Final results are rounded down.
|Standard Guns||Shotgun Class||Sniper Class|
As an example, if standing directly next to your target (non diagonally) most guns get +37%, shotguns get +50%, and snipers take a -24% penalty. The bonus does indeed increase higher still if you manage to get your unit on the same tile as an enemy.
In addition, a very slight fractional penalty may be applied depending on the direction the shot is coming from. For example, a soldier with a rifle sitting an exact two tiles away from an alien may have a 33% range bonus, but another soldier with the same weapon and at the same distance might only get a 32% bonus if he's on a 90° angle (it appears this is because the base bonus drops from 42 to 41.6 in such a case, though the reason for this is unknown).
Note: The partial brackets used in the shotgun formula represent a floor operation, or to put it another way, "round this value down".
Note 2: These formulas may not be 100% accurate.
Terrain - Cover & Height
Aside from the aim/defence bonuses available to each unit through their own powers and abilities, the environment also plays a key part in determining chance to hit.
One of your primary sources of defence - especially in the early game, before you can equip some decent armour - is cover. While understanding the full mechanics of cover is important (when it applies, how to circumvent it, and the risks of relying on it), for the purposes of accuracy the rules are that a half shield gives +20% defence, a full shield gives +40% defence, and if the firing unit has a flank or the target has no cover at all, then the shooter instead gets a crit chance bonus.
If a flank isn't possible and the cover can't be removed, a good way to get around it is with the height bonus - a unit on higher ground gets +20% aim bonus against units on lower ground. Snipers can add another +10% to aim and +10% to defense with the Damn Good Ground perk, this perk also works when flying much higher than the enemy. Most flying units (all except Hover S.H.I.V.s) possess Evasion ability which grants an equivalent of low cover (+20% defence) when flying, also making them immune to being flanked in the air.
The similar-sounding Head Down ability - only available to non-combatant units as their only action other then moving - grants +10% defence to that unit regardless as to whether they have cover or not.
Finally, Overwatch shots are taken at a 0.7 accuracy modifier, further increased by another 0.7 modifier if the target is dashing. This is mitigated somewhat in that moving units don't get cover, but keep it in mind when setting up ambushes. Regarding the Support's Covering Fire perk, which allows overwatch shots on units that are in cover, there's no indication if the game considers the unit's cover or not.
When The Game Cheats...
It's been reported that on difficulties below Classic, invisible adjustments may be placed on aim when you're low on units. The only way to incorporate them into your tactics is fore-knowledge, as they don't show up on the shot info screen and aren't factored into the chance to hit the game shows you.
All of the below only apply if you have four soldiers or less in play:
Easy & Normal modes
- Chance to hit is 120% of the displayed value. Hence if you see 84% or above, the shot should always hit.
- Alien aim get a cumulative -10% for every consecutive hit on your units, resetting when they miss.
Easy mode only
- Missing a shot which had at least a 50% chance to connect adds +15% to the next such shot you make, cumulative. The counter resets when a shot hits, and is capped at 30%.
If the number of soldiers is 4 or less, and your squad has taken casualties (KIAs or Critical Wounds):
- Your aim is increased by four minus the amount of soldiers you still have, times 15%. Hence having one soldier in play grants him a +45% aim bonus.
- Alien aim is reduced by four minus the amount of soldiers you still have, times 25%. Hence having one soldier in play grants him a +75% defence.
Normal mode only
- Missing a shot which had at least a 50% chance to connect adds +15% to the next such shot you make, cumulative. The counter resets when a shot hits, but otherwise has no cap.
If on easy with exactly four soldiers active, or normal with four or less, shots with a stated accuracy higher then 95% are capped down to 95% - unless they would reach 100% or more, in which case they are unaffected and should always hit.
Adjustments are made on a side-wide basis - for example, if a given soldier misses, he's not the only one who could benefit from the resulting bonus for your team's next shot.
- XComGame.upk, XGAbility_Targeted class, AdjustToHit and CalculatedOdds functions.
While psionic abilities have their own mechanics for determining the odds of success, two are relevant in the discussion of firing accuracy:
Mind Fray is the first ability granted to any budding psi-user, and against most races, deals very reliable (if not guaranteed!) damage. Assuming it doesn't pop the enemy's head outright, that unit will suffer debuffs for two turns including a large -25% aim penalty.
Telekinetic Field is purely defensive; it acts like a dense one-turn smoke cloud, granting +40% defence to any units standing near the point it was triggered. However, taking it precludes the use of Mind Control, which is perhaps a better defensive option - after all, taking total control of your enemy prevents them from shooting at you in the first place.
Random Number Generators (or RNGs) are common algorithms intended to produce sets of unpredictable numbers. They're not usually written by regular developers, but are rather provided by the programming languages they use. Think of them like dice, but you can choose the amount of sides - when XCOM calls its RNG to see if your shot hit or not, it's metaphorically rolling a hundred-sided die; if the result is a number higher then your chance to hit, the shot misses. Likewise, if you've seen any intentionally random behaviour in any game, then an RNG is behind it.
Computers lack the facilities to "make numbers up". So, RNGs instead calculate figures based on at least two bits of information: a "seed" value, and the amount of numbers that've been returned since that seed was first used (or, sticking with the dice example, the number of "rolls" you've made with them since starting your game).
Because of this, if you choose a given seed value and ask for five rolls in a row then start over and do another five rolls with the same seed, you'll get the same numbers back in the same order every time. Hence to achieve results that appear truly "random" to the user, standard technique is to choose a seed value that'd be very hard to predict (such as the time taken from the system clock) then never intentionally use that seed again.
XCOM (amongst other Firaxis games) deviates from the usual way of doing things in one way - by recording the seed and roll count when you save your game. Hence if you save the game before firing, then reload and try it again, the same seed & roll count gets used and the result generated is the same.
This may give an impression that the game's events are pre-determined, but they're truthfully only calculated when and where they're required - no one knows what'll happen until you go ahead and make that shot for the first time. The point is to prevent players from cheating by reloading high-risk shots over and over until the dice roll in their favour and they hit. If you took a high-risk gamble, your save slot won't allow you to dodge the consequences.
That's not to say that the system can't be exploited - if your assault just missed a 98% accurate shot, you COULD reload the game and just have him do nothing. Assuming the alien has about the same chance of hitting (or less), it'll be the one to suffer the effects of that low roll when it fires - not you. You can also do things in a different order, so if you take a 50% shot and an 80% shot and they both miss, try reloading and taking the shots in the opposite order, the 80% one may well hit this time.
|XCOM: Enemy Unknown: Gameplay Mechanics|
|Action System • Movement • Chance to Hit • Cover • Critical Hits • Critical Wounds • Damage • Flanking • Overwatch • Suppression|