Sunday, May 18, 2008

Making Things Worse

One of the major challenges of game AI is creating AI that's plays at an appropriate skill level for a range a players. Most games need AI in easy, medium, and hard settings so that as players become better, they can face more appropriate challenges. There are three typical methods for solving this problem.
  • More enemies appear on higher skill levels
  • Higher skill enemies have more health and deal more damage
  • Higher skill enemies act more intelligently
The first two are obviously far easier to implement than the last, but more intelligent enemies gives more satisfying results. While additional enemies works fine for a single player first person shooter like Half Life, it's not an option for Quake 3, since the player selects the number of enemies when they pick the level. The second option, adding more health and damage, was exactly what iD software used for the two lowest skill bots in the original AI. While skills 3-5 gained better accuracy, skills 1 and 2 simply dealt less damage and died faster than a skill 3 bot.

Of course it's the last option, coding additional levels of intelligence, that's "real AI". The other methods have their place, generally when deadlines must be met. But the reason good human players beat bad human players at a game isn't that the bad players accidentally had the "deal less damage" option checked. They just get outsmarted. High skill AI needs to outsmart people more often than low skill AI does, and you don't encounter that kind of AI very often in computer gaming.

When designing BrainWorks, I was determined that all skill gradations would be created by additional intelligence, at least where applicable. So, yes, bots will have more accurate aiming as their skill increases. But they also gain abilities. Here are some of the abilities BrainWorks bots gain and their minimum skill levels. (Skill 1 is the lowest, 5 is the highest.)
  • Strafe jumping: Skill 4
  • Blast shots: Skill 3
  • Item Respawn Timing: Skill 3 (1 item), 4 (2 items), and 5 (3 items)
  • Simultaneous movement and attacking: Skill 2
That's right, a skill 1 bot stops moving whenever it starts shooting. There are also other abilities that gradually increase in effect as skill increases:
  • Aiming speed
  • Aiming error correction
  • Audio detection of enemies
  • Memory of enemies no longer in view
And more that I'm sure I've missed. To make realistic low skill bots, it's best to start with realistic high skill bots and then take away intelligence until the result seems appropriate for the intended human's skill level. AI designed the other way, by taking bad AI and giving it more health and damage, never quite feels realistic.


Dave Mark said...

Right on, Ted. Good work sir! And keep preachin' that real AI rather than the fake "loaded dice" crap that we see too much of.

alexjc said...

Nice topic, great post! A few points:

1. Typically, the bots are given very poor aiming skills to match what players can do. Simple motor control is something bots do very well. So you can tweak that to great effect to find the right balance.

2. If you have to implement the intelligent behaviors anyway, it can be a real pain to maintain and debug all the combinations of "dumbed down" AI. Why didn't *this * case work?

3. There's absolutely nothing wrong with loading dice and most often it gives you the best results anyway! (How would you balance a game between human players without using such techniques?)