Contents
Intelligent Mistakes: How to Incorporate Stupidity Into Your AI Code
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [13]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Trion Redwood City
Sr. Environment Artist
 
Trion Redwood City
Sr. Evnironment Modeler
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Crystal Dynamics
Sr. Level Designer
 
Sony Online Entertainment
Brand Manager
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [50]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Time Fcuk - A Postmortem [2]
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Intelligent Mistakes: How to Incorporate Stupidity Into Your AI Code
by Mick West
17 comments
Share RSS
 
 
March 18, 2009 Article Start Previous Page 2 of 3 Next
 

Heads Up!

In some heads-up games, such as chess and pool, the computer has a huge advantage over the player. Modern chess programs such as Fritz are vastly stronger than nearly all human players.

In pool and snooker games, the computer can be programmed to never miss a shot. However, people want to play against an opponent that is well matched to their skills, and so there are generally levels of AI in the game that the player can choose from.

Advertisement

The simplest way to introduce stupidity into AI is to reduce the amount of computation that it's allowed to perform. Chess AI generally performs billions of calculations when deciding what move to make.

The more calculations that are made (and the more time taken), then (generally) the better the computer will play. If you reduce the amount of calculations performed, the computer will be a worse player.

The problem with this approach is that it decreases the realism of the AI player. When you reduce the amount of computation, the AI will begin to make incredibly stupid mistakes -- mistakes that are so stupid, no human would ever make them. The artificial nature of the game will then become apparent, which destroys the illusion of playing against a real opponent.

Remember what we are trying to accomplish: We want people to have an enjoyable experience. No matter what the game, we want the players to feel challenged so that when they win, they feel a sense of accomplishment. We want them to feel that they were playing against an opponent who was really trying to beat them.

By reducing the amount of computation, we create an AI opponent that is trying to win, but has been crippled in a way that leads to unrealistic gameplay. But does the player actually care about what is going on under the hood? What if we don't cripple our AI, but instead let it play at full strength, but have the AI deliberately throw the game?

Throwing the Game

In sports, "throwing the game" means one side makes a series of intentional mistakes that look natural, but result in losing the game. This behavior is rightly vilified by players and fans, as the agreement is that there be a contest between two equal opponents, or at least, two opponents who are trying equally hard to win.

But in computer games, it's impossible to have an equal match. It's humans versus machines. One side has an advantage of being able to perform a billion calculations per second, and the other has the massively parallel human brain.

Any parity here is an illusion, and it's that illusion that we seek to improve and maintain via the introduction of intelligent mistakes and artificial stupidity.

The computer has to throw the game in order to make it fun. When you beat the computer, it's an illusion. The computer let you win. We just want it to let you win in a way that feels good.

AI programmers need to get used to this idea. We are manipulating the game, creating artificial stupidity, fake stupidity. But we are not predetermining the outcome of the game.

We don't set our AI with the intent to lose the game, but rather to give the human player a reasonable chance of winning. If the human plays poorly, the AI will still win, but the player will at least feel like she came close to beating a strong opponent, and thus feel like playing one more game.

Hidden Handicapping

Computer chess expert Steven Lopez (see Resources) describes how in human versus human chess, it's acceptable for a high-ranking player to give a much lower ranking player an advantage at the start of the game by removing some of his pieces from the board before the game begins.

When the game starts, the master player and the novice player are still playing to the height of their abilities, and yet the game is more evenly balanced. The master player does not have to play "stupid" in order to give the novice player a chance.

However, humans playing against a computer do not like to be given an advantage in this way, and prefer to play the full board against an AI opponent of approximately their skill level.

The programmers of Fritz hit upon a solution that involved the AI deliberately setting up situations that the human player could exploit (with some thought) that would allow the human to gain a positional or piece advantage. Once the human player gained the advantage, the AI would resume trying to win.

At no point here is the AI actually dumbed down. If anything, there is actually quite a bit more computation going on, and certainly more complexity.

The goal of the AI has shifted from "win the game" to "act like you are trying to win the game, but allow the human to gain a one-pawn advantage, and then try to win." The AI needs to be more intelligent in order to appear less intelligent.

 
Article Start Previous Page 2 of 3 Next
 
Comments

Chris Crowell
profile image
Mick, great article. Allow me to add my own two cents.
When we were working on Rumble Racing, the goal was to make the AI opponents feel like people. We had a matrix of possibility for introduced errors, where at each pathing junction the AI had a choice to take a fast line or slow line. This matched up how people drove the tracks, where small errors in braking and taking the corners made the cars seem to go slower because of poor driving, not simply going slower.

Greg Wilcox
profile image
Excellent piece! I'm all for more AI with human quirks - particularly in certain action or shooter games where AI seems almost perfect. Now, I'm not asking for Star Wars stormtrooper-style inaccuracy, but it would be nice to see a bit more than the now standard, duck for cover and toss a grenade

Hey Chris - Rumble Racing was (and is, as I still play it today) one of those great games where one really got to see the AI do some things you'd expect a live opponent to pull off, so it was always a blast to race the same tracks multiple times and almost never see the same result.

g.

Tom Benda
profile image
I've experimented with a sort of artificial "anxiety" system in an avoidance simulation, where many near misses will do "damage" to their confidence score, and their confidence score affects ranking of next moves in a search-based approach. The more unnerved the AI, the more likely they are to refuse to take a move which will place them in danger. That refusal results in inaction which is often lethal.

This gives moments of hesitation and panic which look extremely realistic (at least in something as simple as driving or fleeing). I've tried to think of a good way to cause the AI to flipflop between decisions only when they are in a panic, however that seems to require breaking good decision making skills (requiring a set amount of time before they can change action).

It's nice to see an article on this subject. A good deal of thought has to go into creating lifelike artificial behavior, and I'm glad to see people in the industry upping their game.

James Cooley
profile image
One of the things I would like to see programmed in are more AI opponents with a "survival wish". Nobody wants to get shot. Only in games and bad movies do opponents keep rushing against impossible odds or when severely wounded. Give me situations where an opponent throws down their weapons and tries to retreat. Or, when the first bullet flies by, ducks for cover. That doesn't just keep walking patrol while stepping over the dead body of their comrade I sniped seconds before. Balancing "fear of death" in with the need to have enemies that are fun to fight may not be easy, but I would love to see more of it.

John Smith
profile image
I must say I don't agree with you. In your pool example, the AI is using the same engine that's used for physics simulation, which gives it unfair advantage. Try using the same AI on other pool simulation that runs on different engine, and see how it fares.
AI should have the same interface to game as the player. All positions and values that bot receives should be slightly inaccurate. AI algorithms should be developed separately from gameplay mechanisms.

If player detects that AI is throwing the game, immersion in gameworld suffers, as the player realises that the whole gameworld revolves around him. I believe the way to go is to introduce quirks and imperfections in AI behaviour, but not have it dominate the game by deciding at which point should the player start winning.

Savas Alparslan
profile image
I am thinking of a different stupidity scheme. In this scheme, you'll run the perfect algorithm everytime, but, you'll poison variables randomly. I mean, you'll increment/decrement or negate random variables in each turn. You can change number of variables to poison to determine how stupid the AI would be.

Adam Bishop
profile image
I like James' suggestion. It reminds me of the pen and paper RPG Shadowrun, in which all but the most hardened enemies will eventually try to escape from you after reaching a certain damage threshold. I like that idea of certain enemies running away if they're, say, just a beat cop rather than a Navy S.E.A.L. Of course, that could pose problems in a game which is entirely about the player killing enemies, so I think a decision to include fleeing behaviour in enemies would need to involve a bit more creativity about things like level design so the player didn't feel cheated. Some players may feel really powerful because they can make enemies run from them in fear, but other players may feel as though they're not getting the game they thought they were.

Duncan Rabone
profile image
One thing that I would like to see is A.I. designed to act more purely based upon the actions of the player. Frequently I would perform some kind of deliberate action, while the A.I. continues to act the way it was designed but with emphasis on simple variables (difficulty and/or intelligence variables) What I'm after would show more in the earlier mentioned FPS or action set-piece A.I.

eg: I try to rush into the range and view of my opponents from whence they previously had no knowledge of my presence. Current A.I. would allow all notified opponents to 'snap to' my character and begin firing/ducking for cover with their speed and accuracy determined by difficulty. What I want to happen is for the opponents "psychology" to determine their actions, even though they may be 'trained soldiers.' I just initiated a "surprise attack" and expect them to act surprised depending on a combination of how alert the opponent may be and how efficiently I got within range.

It may sound like what I'm asking for is scripted A.I. set-pieces. In one way yes, but this has much larger scope. To me, realistic 'mistake making' A.I. mean an opponent that "feels." Will retreat because he fears, will fight because he's confident. I'm an artist so I don't know how to implement it, but it would be good to see the A.I. literally go "whoops"

Tom Newman
profile image
Great topic of discussion! One of the most frustrating things a player can experience is the feeling that the AI has an unfair advantage. Many games give the player a feeling that the AI knows every inch of the level, and knows where the player is at all times. Other games make the player feel like the AI is just another environmental obstacle, like a rolling barrel (i.e. stupid AI). This will always be a delicate situation to balance, and well balanced AI is the difference between a good game and a great game.

Personally, I like gmaes that use the old D&D system of % to hit; etc; as I always feel like it's an even playing field between the player and the computer. Many games do a great job with AI (like Fallout 3 most recently), but I think some FPS and action games where the AI seems to be on a straight path to the protagonist can benefit from some rpg-style stats under the hood.

Jason Bakker
profile image
Savas: The poisoning variables idea sounds interesting, but it would probably be very difficult to iron out the totally stupid mistakes that are talked about in the article from it.

John Smith: Try explaining to your producer that you need to develop two different physics systems - one for the game to use, and one for the A.I. ;) Seriously though, your example assumes that with the right interfaces, an A.I. "brain" would act similarly to a human brain, which simply isn't true - even if your A.I. was unable to be accurate, it doesn't mean that it would feel like you're playing against anything analogous to a human opponent.

Games are experiences in which you need to create a suspension of belief, and the A.I. is a tool in that - there will never be a fair fight between an A.I. and a human, but with your A.I. making the right mistakes, you can trick your player into thinking that there is. And at the end of the day, that's all that matters! ;)

JM Janzen
profile image
Particularly connected with 'Throwing the Game' on the second page. While I understand that it wasn't the spirit of that paragraph to suggest that aeies throw games like humans throw games, I have noticed a few video games (particularly RTSes) where the computer just seems to /give up/ at a certain point.

C&C 3 is case in point for this.

Steve Breslin
profile image
I completely agree about increasing the intelligence for this purpose; merely adding a random factor or reducing the number of calculations (decreasing intelligence in the programming sense) does not lead to the best gameplay.

You mention the prospect of setting up a situation that the player can exploit. That's definitely a fine solution to the handicapping problem! My interest is in the preconditions for setting up such a situation.

As you show with the poker examples, there's usually a reason that a player makes an error, or a type of error which is more typical. (Folding to a big raise, against the odds. That one is a very good and clear example! Folding when "unclear" about the odds... I think this means that you can teach the machine which hands are complicated for a human to calculate the odds for.)

Let me give another example to sharpen the angle I'm getting at.

Let's say we were writing a chess program aimed at beginners (defining 'beginner' as not absolute novice, but rated under 1400). We'd want the machine to make beginner-like mistakes. The first step in "dumbing-down" the AI would be to figure out what kind of mistakes beginners make, and under what conditions. We'd be doing pretty well if we programmed the machine to threaten checkmate when it can be beaten by mate in three. We'd be doing even better if we figured out which kinds of mistakes are more obvious for players (and avoid those). So, the machine wouldn't fall for a sufficiently "obvious" mate in three.

In other words, we'd want a function which evaluates the "cleverness" of a move; the machine, imitating a beginner, is less likely to notice clever moves. Then, when we're setting up a scenario for the player to exploit, we have a believable reason for making the "error."

Kriss Daniels
profile image
Yup

The AI is not playing the game to win.

The AI is a granny playing with a spoilt brat who throws a tantrum when it loses.

Personally I prefer AI with exploitable weak points, but most gamers are of the spoilt brat variety.

Ian Hardingham
profile image
I love this - I had no idea chess games were making dynamic meta-game puzzles for us now.

UT used to give the bots fewer shards in the Flak Cannon at lower AI levels, and make the rockets slower... pretty crazy.

We talked about this on the games-and-industry podcast Visiting The Village this week (www.visitingthevillage.com).

Michial Green II
profile image
interesting I must say. As a gamer/developer in training I must say that it is quite obvious how most AI make their decisions. I remember when it was very common for Programmers to create AI personalities, AI with a specific bias to a certain strategy or decision.

For example, take the game Monopoly. there would be specific strategies or "Tendencies" that were predetermined by the programmer to have top priority over other decisions regardless of how useful it was.

For instance, Maud will always buy level 4 properties (The green and blue properties) if able, and place houses on them as soon as possible. This would include a bias of being willing to offer VERY large sums of money in order to acquire there properties or giving up any lesser (according to the bias) property. while at the same time its shunning Level one properties entirely; this would include certain reckless actions, such as trading properties that were not level four even if it owned two out of three of a lesser property of the same color.

This sort of AI gave the illusion that this AI personality had a strategy. you would notice how "badly" he wanted boardwalk and you would hold out for a better offer. You got the feeling you were outsmarting him. and if you picked up on the tendencies, you felt much smarter, and rewarded for victory over them.

I think it would be a nice little tweak to shooter games if personalities were used. Players would know that there were very tactful enemies, as well as overyly aggressive (Reckless) ones. In this instance players can have waves of stupid enemies, mixed with a few, "Hard to kill" Bruce willis types. I think a dynamic AI such as this will enrich most shooters.

Barton Massey
profile image
In his most excellent book "One Jump Ahead", Jonathan Schaeffer talks about how as the play of his human-machine checkers champion Chinook improved, it got progressively less fun to play against. The essence of adversary search is minimax, and risky positions are tricky for the computer to evaluate, so it is always better to avoid them.

Schaeffer recommends that you tune your player so that it is risk-seeking. This doesn't necessarily make it inherently weaker, but if it gives its opponent an interesting game they wil be happier even if they lose.

Luis Guimarães
profile image
@Michial Green II. There is a bot for CS where you can configure every bot Entity, and also create new ones, also, in UT3 the AI code is related to the character model.


none
 
Comment:
 


Submit Comment