How do game designers program the characters to behave in different levels of difficulty?


e.g. A soldier shooting you faster on Veteran level but taking a bit to shoot you in Amateur.

In: Technology

In simple terms, they manipulate variables within the code to produce desired outcomes. It’s all just numbers, so everything from physics, to reaction times, to anything else you can think of can be changed. The difficulty levels are essentially just presets with those variables preconfigured to specific numbers.

As an example, in Bioshock the splicers, when they spot you for the first time, always miss their first shot by design. That way the player gets a moment to recognize and react to the threat before they actually take damage. Scaling up the difficulty for the game might involve removing that feature or other intentional AI behavioral handicaps. If the developer is lazy (Bioware and Anthem or Bethesda and Skyrim) they’ll just tack a modifier onto the health and damage calculations for an enemy. A Giant in Skyrim on Normal mode might have 150 x [1 x player level] x 1 health and do 30 x [.5 x player level] x 1 damage, but in hard mode he has 150 x [1 x player level] x 1.75 health and does 30 x [.5 x player level] x 3 damage.

EDIT:: Markup, please ;_;

Theoretically the computer program is capable of making invincible enemies with perfect aim and instant reaction times. To make the game easier, they just program the enemies to move slower and miss on purpose. If the enemies have special powers or movements (like dodging, taking cover) then the lower levels will just program to do that less. They may program them to move in ways that look more natural while still being easy.

My favorite example is the last level of call of duty world at war. On veteran mode they just make the bad guys throw like hundreds of grenades at you and never stop spawning.

This is a really cool question. Game designers use lots of sneaky tricks to make enemies seem smarter or better without having to do a lot of extra work.

The easiest and most common way is to just make enemies do more damage. As long as you have a chance to dodge an enemy’s attacks, making the attacks hit harder makes the enemies seem more effective. FEAR, a game often considered to have the best enemy AI of any first-person shooter, does nothing but increase damage to make hard-mode enemies seem ‘smarter’.

Another common tweak is accuracy. At low difficulty, the designers can make enemies spray a lot of shots at you, but intentionally miss, so you feel like you’re in an intense battle but stay alive. The classic shooter Goldeneye 64 makes enemy shots go really wide – sometimes to the point of being silly – at low difficulties. Call of Duty games do something similar – the easier the difficulty, the more the enemies aim for your teammates instead of you.

Many AI’s are based on finite state machines and hierarchical state machines. The AI decides between a few different ‘game plans’ and then chooses how to perform them. If the AI makes these decisions often, they’ll seem aggressive and clever; if they wait a while between decisions to ‘think’, the player will get more chances to outmaneuver them. This is used in games like Gears of War and Vanquish, where the gameplay focuses more on moving into position than accurately hitting targets.

Some game AI’s, especially for strategy and card games, use a search tree. The bot imagines making many different plays, and picks the line of play that brings it closest to winning the game. To make the AI harder, the designer can have it imagine more possible plays, and even imagine sequences of plays far into the future. To make it easier, the designer can have the AI intentionally make worse or riskier decisions once in a while.

Excellent game designers put a huge amount of thought into enemy difficulty. The objective isn’t to make easy mode easy and hard mode hard. The designer’s goal is making easy mode forgive mistakes, and hard mode punish mistakes, so easy-mode players can have a laid-back and creative experience, and hard-mode players have a reason to master the game.

When enemy difficulty is done poorly, it’s really bad. Halo 2, Uncharted 1 and 2, the Mass Effect series, and Far Cry 2 have notoriously brutal hard modes in which impossibly beefy enemies have supernatural aim and kill you in a split second. Only a few weapons are powerful enough to use, and you need to rely on cautious play and glitches to have any chance of winning.

In simple terms, let’s say the AI’s gun accuracy is determined by a percentage. This percentage is the chance that the AI will hit you with each gun shot.

Easy: 40%

Medium: 60%

Hard: 90%

Numerous other values are also changed in difficulty settings. Such as how easily the AI can detect you, how many enemies there are, etc.

Changing the difficulty setting will also sometimes enable certain AI functions. Such as enemies will call nearby allies over to help them fight you, or they will try to flank you, etc.