Contents
Intelligent Mistakes: How to Incorporate Stupidity Into Your AI Code
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 23, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [12]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [16]
 
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 23, 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 23, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [7]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [7]
 
arrow iPhone Piracy: The Inside Story [51]
 
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 23, 2009
 
Managing Creativity
 
Time Fcuk - A Postmortem [3]
 
Accepting the Inherent Value of Games [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 3 of 3
 

Poker AI

When I programmed the AI for Left Field's World Series of Poker, the AI computation was basically the same for each difficultly level.

The computer would calculate the odds of winning based on the known cards, and an estimate of the opponent's hand strength based on betting history. The odds would then be used to calculate a rate of return, which would be used to decide if they would fold, call, or raise.

Advertisement

There were many special case rules and exceptions, but that's the basics. The AI players would all make the same extensive computations, running tens of thousands of simulated hands through an evaluator to calculate the rate of return.

After these calculations were performed, only then would the differentiation be performed. At that point, the best players would play their best move, and the weak AI players would make intelligent mistakes.

For weak poker AI, an intelligent mistake consists of figuring out what you should do, and then not doing it, so long as not doing it does not make you look stupid.

For example, if the human player just put in a big raise, yet you know there's a 75 percent chance your hand is the best, then an intelligent mistake would be to fold. The odds are the AI would win, yet we are simulating a weak human player, and weak human players often fold to a large raise when they are unclear on their odds.

Conversely, weak human players often call when their chances are weak. It's a natural thing to do and allows us to reduce the strength of the AI player, without it looking artificially stupid.

These intelligent mistakes were implemented in a probabilistic manner. The fake-stupid AI would not always fold when the human player seemed to be bluffing -- it was just more likely to.

This worked very well in the highly random game of poker, because the player could never tell in any individual situation if the AI was actually making a mistake.

Since the AI was still performing its full set of millions of calculations, it never made mistakes that were inhumanly stupid, but the layer of artificial stupidity brought on by increased recklessness was enough to even the playing field and give the weak and average human players an enjoyable game.

Artificial Inaccuracy

In pool and in shooters, the computer AI is blessed with an omniscient accuracy. The shooter AI knows down to the billionth of an inch exactly where you are, and could shoot your hat off your head from five miles away. Similarly in pool, the AI knows the position of every ball and can calculate where every ball will end up before it takes a shot.

When I implemented my snooker AI, it could perfectly pot any ball off two cushions, and would almost always get a perfect break of 147 every time it played (except when it potted the white due to its lack of positional play).

It was obviously not a fun opponent to play against, so even at the highest levels, the accuracy had to be reduced, and the cushion shots had to be restricted to getting out of snookers.

Simply reducing the accuracy of the AI is not always the best way to improve gameplay. As I found with the "positional play" in snooker, random outcomes that happen to favor the computer are perceived as being intentional. If the ball ends up in a good place, or the poker AI makes a lucky call and wins on the river, it can be perceived as unfair or even cheating.

So instead of reducing the accuracy, I'd suggest, as in chess, we increase the accuracy. In order to provide an exciting and dynamic game, the AI needs to manipulate the gameplay to create situations that the player can exploit.

In pool this could mean, instead of blindly taking a shot and not caring where the cue ball ends up, the AI should deliberately fail to pot the ball and ensure that the cue ball ends up in a place where the player can make a good shot.

In a shooter, the enemy aliens should not simply randomly break from cover -- they should sometimes break from cover when the player is close to them and panning toward them. They should "accidentally" throw themselves into the line of fire to make the game more interesting.

Luck of the Draw

Playing against a perfect opponent is no fun. But playing against a crippled opponent is no fun either. To create more interesting gameplay, we have to introduce the concepts of artificial stupidity and intelligent mistakes.

Intelligent mistakes seem like failings on the part of the AI, but are actually carefully calculated ways of throwing the game that make it more entertaining for the player. This does not remove the challenge, as the player still has to have a certain level of skill.

For the programmer, adding intelligent mistakes is much more complex than simply reducing the accuracy of the AI, but provides a much more rewarding experience for the player.

Resources

Liden, Lars. "Artificial Stupidity: The Art of Intentional Mistakes," in AI Game Programming Wisdom 2, Charles River Media, 2004. http://lars.liden.cc/Publications/Downloads/2003_AIWisdom.pdf

Lopez, Steven. "Intelligent Mistakes," Chessbase News, 2005. http://www.chessbase.com/newsdetail.asp?newsid=2579

 
Article Start Previous Page 3 of 3
 
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