How do the different difficulty levels vary?

Solution 1:

They vary a lot. The below is by no means an exhaustive list; it contains just the highlights of what I've found from perusing the INI files and a bit of the code.

Aim cheating

Found in: XComGameCore.ini, AimAssistDifficulties

On every difficulty except Legend, the game applies a number of modifiers to both your attacks and the aliens' attacks. There are five categories:

  • Base aim multiplier (Rookie and Veteran): Your shots have an invisible multiplier applied to make it easier to hit.
  • Miss streaks (Rookie, Veteran, and Commander): For each consecutive miss in a turn, your soldiers are given an invisible aim bonus.
  • Hit streaks (Rookie only): The aliens take a penalty to aim for each consecutive hit they have in a turn.
  • XCOM hit chance for dead soldiers (Rookie and Veteran): For each soldier you've had die on the current mission (below 4 soldiers), your soldiers are given an invisible aim bonus.
  • Alien hit chance for dead soldiers (Rookie and Veteran): For each soldier you've had die on the current mission (below 4 soldiers), the aliens take a penalty to aim.

I'm not sure why Commander gives you a miss streak bonus (which is actually higher than Rookie or Veteran). Judging by the comments in the code, it's an oversight and might get patched out.

Other tactical game tweaks

  • Enemy stats, mostly health and armor but occasionally also crit chance, dodge, and aim (maybe more)
  • How likely your soldiers are to be shaken after a mission, and how many missions it takes to recover from being shaken
  • Whether the alien AI goes easy on you; aliens will limit their number of attacks per turn on easier difficulties
  • How long it takes your soldiers to heal from injury (significantly longer on Legend)

Strategic game

Found in: XComGameData.ini, all over the place

Almost too much to list here.

  • Rookie recruiting costs
  • Research time, soldier recovery time, and the time to clean rooms on the Avenger
  • How quickly the Avatar Project makes progress, especially based on how many facilities the aliens have
  • How quickly the aliens adjust their "force level", which influences what enemy types can spawn on missions and what kind of loot you can find
  • Whether you get bonus mission reward intel at regular events (Rookie and Veteran only)
  • How much rushing research at the Black Market helps you (halved on Legend)
  • The chance you'll get given a reward you "need" (e.g. a Scientist or Engineer if you're low on them, or soldiers of a particular class, etc)
  • The intel costs of items at the Black Market
  • The initial game difficulty and how much difficulty increases month-by-month
  • The relative likelihood of which Dark Event you will receive, and how much intel it costs to reveal a hidden Dark Event
  • How long it takes to train a rookie, respec a soldier, or complete psi training
  • How many corpses you need to complete an autopsy instantly
  • How many supplies you get per region per month, and how long it takes to make contact with a region or build a comm tower

Many of the changes are designed so that Legend, which starts out harder, doesn't quickly scale into an unwinnable mess. For example, general difficulty starts higher on Legend, but it grows more slowly than even Veteran does. Legend will still remain ahead of Veteran even with the scaling, though.

Solution 2:

AI

On difficulties below Legend, AI will hold back if you pull too many enemies at once:

  • On Rookie any additional enemies after 4 will do "non-aggressive behavior", such as overwatch, movement to flanking or defensive position without attacking or just skip a turn
  • On Veteran and Commander - after 6 enemies
  • On Legend - no holding back

Targets selection logic depends on the difficulty as well:

  • On Rookie and Veteran, AI is more likely to spread attack over different targets
  • On Rookie and Veteran, the first variation of Advent Commanders you encounter (called M1 internally) will never throw grenades

Source: defaultai.ini. I didn't do in-game testing of this.