Believable Stupidity In Game AI 378
Gamasutra is running a feature written by Mick West, co-founder of Neversoft, about creating game AI that is dumb enough to defeat, yet intelligent enough that its "mistakes" are similar to those a real player would make, thus preserving the illusion that the AI is not just throwing the game.
"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 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. ... 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."
No human would ever make them... (Score:5, Insightful)
Oh, the humanity! Football games drive me nuts when the AI does stupid things no real person would ever do. Why the hell did my fullback just brush by the linebacker that's right in my RB's way?! Why can't I get my linebacker to stay in his lane on running plays?!
I'd love to see the difference in difficulty in Madden being the difference between playing a Jerry Glanville-coached team vs a Tom Landry-coached team. Instead, all increasing the difficulty does is make your opponents more talented but no smarter. Even on the highest difficulty, FBs don't understand their blocking assignments.
it's about the cpu-time (Score:4, Insightful)
Re:No human would ever make them... (Score:2, Insightful)
How much of that is due to difficulty in writing a good AI for a fullback and how much is due to EA not needing to write a good AI for a fullback because there aren't any other football games left to compare it to?
When you have a license monopoly, why try?
Stupidity is a component of intelligent behavior. (Score:5, Insightful)
And vice versa.
One thing that is stupid: trying the same things that failed in the past.
This is a component of smart behaviors as well. If you don't know what to do, try something and watch very carefully how it fails. If you are in a desperate situation and you are going to definitely fail through inaction, then try an action which failed in the past and hope you get lucky. Or vice versa, when the action that usually works looks like its going to fail, try doing nothing.
Animals freezing in the face of danger is an example of this. It's not much of a defense, but you might get lucky. Maybe the prey a couple animals down the line will get itchy and draw the predator's attention.
On the other hand, smart behavior can be a component of stupidity. If the red button gets you a treat 80% of the time and the green one gets you a treat 20% of the time, the intelligently stupid thing is to push the red button 100% of the time. The stupidly intelligent thing is to try to work out the pattern of red/green rewards.
If you want realistic model of stupidity, provide the NPCs with a range of decision making strategies, all of which work to some degree, but the better of which take more effort (computation). The NPC can choose between the strategies with a random function weighted towards the better strategies, but as time and "stress" come into play the function can shift towards the easy but less effective strategies.
That's a pretty good model of human performance "choking".
Evolution did not produce human stupidity because it was useless, after all.
Re:Easy solution (Score:5, Insightful)
You're joking, but having realistic actions like teabagging a defeated corpse brings a lot more illusion of reality than a lot of the other stuff they do.
As for the article, I saw a lot of 'dumbing down' and 'intelligent mistakes' ... But I saw absolutely nothing about 'personality'. -That- is what makes an AI seem real.
Take the poker example. If you just create 3 levels of players, bad, good, and perfect... There's no personality.
Instead, you make different players: Cardsharp, timid bets, reckless bets, etc. In other words, you model the AIs after real player types.
In other words, you're trying to pass the poker Turing test with this AI.
Re:Cheating AI (Score:3, Insightful)
A lot of these things are hacks to make the AI fast enough to run on the kind of machine that the game targets. For each enemy to have proper vision, you need to do ray casting from each enemy to the player (quite expensive, and very expensive with lots of enemies) and you also need to program them to model human behaviour when the person is occluded so that they guess where the person is. Alternatively, you can just do a distance check, which takes a dozen cycles, and have them able to track the person anywhere inside a sphere of a certain size.
Red Alert did something similar. Rather that produce complex AI that monitored the entire map, each structure had a very simple rule-based AI which tried to make sure that the fighting force was composed of a certain percentage of each unit type (with the total over 100% so it was always short of at least one kind of unit). This cheated - being able to manufacture a different unit in each factory - but only to simplify the AI.
F.E.A.R. (Score:5, Insightful)
They did this through heavy use of waypoints and scripted events. If that's what you have to do to make it realistic, then by all means, do it.
Here's what I'd like (Score:5, Insightful)
A computer that plays on equal terms.
AIs often win in some games not by the virtue of being smarter, but by having an unfair advantage. Examples:
My suggestion: An AI should be coded as a bot, within the constraints given to the player. If the player can only see a part of the battlefield (like in Starcraft) then the AI should have the same limit and need adjust its own viewport to gain awareness of an area. It should also be limited by the fog of war, and lack the ability to see out of the back of its head. To put in another way, a fair Starcraft AI would be one implemented with a camera pointed at the screen, controlling only the keyboard and mouse inputs.
The idea is that I want to be beaten because the AI is indeed smarter, not because it's got a superior access to the battlefield I can never gain.
Chess probably comes closest to the sort of thing I want -- the AI and human are fighting on very equal terms. I don't see the calculating millions of positions a second as a problem, that's simply an implementation detail.
Re:Cheating AI (Score:4, Insightful)
No. What should humiliate you, is the fact, that there is no "machine" "winning". There is only a machine blindly and incredibly stupidly processing a giant set of rules, created by programmers, out of a giant amount of knowledge of many many persons.
So in fact you play a whole expert comitee that can every minuscule detail down to the stangest exception, in advance.
Now if you win that, you win against them all, and are truly a genius!
So how about that fixing your self-confidence issues? ;)
Re:Cheating AI (Score:4, Insightful)
Re:Deep Blue (Score:4, Insightful)
Re:depends on the stupidity (Score:2, Insightful)
Planning vs. execution (Score:3, Insightful)
That particular game programmer happens to have worked on games where perfect execution is possible. In chess, "execution" is moving the pieces; in poker, it's moving the cards. The game engine is expected to perform those operations perfectly. There's no "friction" (in the sense that Clausewitz used the term) in such games.
That's not true of a combat game. Weapons have finite accuracy, as do humans; sometimes there will be a miss even if the shooter, human or AI, did everything right. Weapons can jam (America's Army simulates this.) Running characters don't necessarily follow their planned path; bumps on the ground and slippery spots can interfere. The AI has to face those limitations, too.
Of course, if you make it too real, some kinds of games are unplayable. You can't really drive a car very well with a game pad or joystick. (Watch people driving R/C cars that way. They crash every few minutes.) In most console driving games, the CG of the vehicle is below the ground, to make the thing unreasonable stable.
In my ragdoll-physics days, we'd made enough progress that a two-person martial-arts fighting game with real physics looked feasible. Then we realized it would be unplayable. "Your throw failed because your left foot was out of position. Further to the left. Again!" "Yes, sensi." Real physics in a fighting game would make gaming feel like a bad day at the dojo, although without the bruises. Most of your moves wouldn't work. A game with a learning curve like real martial arts, where you train a few times a week for a few years before you're any good, would never sell.
Re:Money (Score:5, Insightful)
As for it being "unfair" it wasn't touted as fair it was a computer v grandmaster experiment not a ranking test.
The only shady part in my opinion is the refusal for a rematch. If the man is willing to play on uneven ground and give his time (even if paid) to your stunt then you should have the courtesy to let him challenge/redeem himself.
Paradigm shift... (Score:2, Insightful)
Maybe the problem lies in the fact that AI are programmed just to be opponents. While they should be conceived as game masters in charge 'also' of managing the opponent team but with consideration of the overall gameplay.
Re:depends on the stupidity (Score:5, Insightful)
The events you describe in AvP are not necessarily examples of scripted scenarios, but sound more like a scripted set of responses to stimuli the player provides (would the AI react differently if you didn't rip off a soldier's head?). The trick for interesting yet realistic decision making is to allow the AI a range of responses that it can make, and then every time you present the same scenario to the computer you may get a different response. So when the AI is actually making decisions, rather than just following a pre-scripted path, this allows the player to make actual decisions in response, rather than just following their own memorized trial-and-error derived path to success.
The key to a good scaling AI doesn't have to be that tricky, it can just be a matter of what range of choices you allow any given AI to make and what sorts of "mistakes" you throw in that pool of choices.
When I face "easy" opponents in an FPS, I want them to use simple tactics (not just be unable to hit the broadside of a barn) like charging forwards blindly, or getting scared easily and retreating or even panicking, and being easily suppressed by heavy fire. When I face more advanced opponents, I want the range of their choices to move up the tactical scale to include flanking maneuvers, suppression fire, use of cover, and tactical retreats. A good mistake for an advanced AI would be to assume you're in the wrong position if you duck out of view and to attack that wrong position vigorously (as opposed to the omniscience a lot of AI's seem to have). They don't have to be any more accurate or need any more bullets to kill than an easy bot, but at least they could present more of a real challenge without artificially increasing their stats. Granted this is harder to do and would require actual programming rather than just increasing a few numbers, but that's the price for good AI in your game.
Re:Deep Blue (Score:4, Insightful)
Many people in the tech world only know Kasparov's name because of his battle with Deep Blue. His name will likely be in history books for this reason. I would say he did indeed have something to gain by competing with the machine.
Re:Cheating AI (Score:3, Insightful)
I ran into that problem just a few days ago playing Far Cry 2. I was sneaking into the airport to assassinate a character who was in a hanger... As I'm walking around the outside of the hanger towards the entrance, I hear pistol shots at the wall to my left. The AI detected me walked around outside the hanger while he was inside and with perfect accuracy, started trying to shoot through the wall at me. That's the sort of problem this article was about:
I'm not necessarily saying that this is truly desirable from and FPS AI, but the top Counter-Strike players can do this and do this all the time. I played in a top-tier CS for a while and we learned where all good spots for shooting through walls were. The map "de_nuke" was notorious for having these spots. As CT'S we just listen for the T's, and if they were dumb and didn't walk, a spotter would announce their position, we shoot through the walls and we would generally get a kill or two and then get subsequently accused of hacking. If I were playing an FPS and I had good positional audio, I would probably do the same thing the AI did (without the perfect accuracy, but most FPS AI have randomized aiming too). Then again, you would be probably still be pissed, so maybe in this scenario the AI should have more random aiming when they use sound to determine your position.
Re:Deep Blue (Score:4, Insightful)
Re:Competing goals (Score:5, Insightful)
I agree with this totally. One of the bigger reasons some players fail at a game is that they aren't actually playing the same game as everyone else.
What I mean is illustrated by some post I read once where some jerk, who was also a rather good player, laid it out bare:
Many people don't play the game. They invent their own little rules for what is "fair" or "better" or "morally right". This handicaps them. You win by playing the game and using all of your abilities and all of your assets to do so, no matter how "cheap" or "skill-less" they seem to you.
If the game makes it so that some skill does more damage for less effort, but you prefer to use another skill because it seems "cool" to you, or you liked the animation or whatever, you deserve to lose.
The one thing that this illustrates is that a computer also tends to have clarity of purpose. They are programmed to kill you. That is what they do. They aren't there to smirk or taunt you (unless that's in the script). They will not dance around or try and add finesse to their moves to look cool. They use the most efficient moves or actions to kill you. Or, sometimes, they only get a certain set of moves, but they are scripted to execute them in a certain manner.
So, basically, by giving your NPCs a "personality" where their goals aren't to strictly kill you with Terminator-like focus, but perhaps to simply make you look bad, or use some moves that *they* think are cool, which really aren't all that useful, you can make them a bit more "human".
The problem with most mobs is that you already know their motivation, so knowing what they will do next is actually rather easy to figure out. So, if you "cheat" with their AI, it becomes apparent to players that you either buffed or nerfed them artificially.
If your mobs act in a manner where they are believably foolish, its a lot easier to handicap them and have a player believe that the handicapping is their lack of "skill", rather than you simply giving them less hit points or some absurd lack of resistance to one damage-type.
Re:Deep Blue (Score:2, Insightful)
Kasparov had immortality to gain. In fact I'm fairly certain most people today remember him only as The First Person To Lose Against A Computer In Chess and have no idea who deep blue is.
Kasparov was the first World Champion to lose to a computer in a full fledged match with standard time controls.
Re:it's about the cpu-time (Score:1, Insightful)
Re:Cheating AI (Score:3, Insightful)
My problem with Crysis was that they had a specific limit to their "vision" I could stand outside that radius and shoot a guy until he died and he would simply stand there not moving. It was very disappointing for me.
Maybe my game was bugged or something.
Re:Cheating AI (Score:3, Insightful)
No. What should humiliate you, is the fact, that there is no "machine" "winning". There is only a machine blindly and incredibly stupidly processing a giant set of rules, created by programmers, out of a giant amount of knowledge of many many persons.
Well, to be fair, there's no "you" losing. There's only a biological machine blindly and incredibly stupidly processing electrical and chemical inputs, based on a set of rules created through years of evolution, and out of the stored memory and neural network training that you have accomplished up to date.
Just because all of that has a high-order output display that looks like consciousness and thought is no more significant than the fact that the computer's display looks like a chess board. We're way more complex than the chess program, sure...it's probably not always going to stay that way.
Re:Cheating AI (Score:3, Insightful)
Its not that fascinating. What makes human opponents bad is their inability to see the board and to think ahead more than 1-2 moves. The stronger a player is the more moves he can think ahead. If you want to make stupid AI, then you need to limit its depth, and give it a percent chance of missing things like pins, forks, skewers, etc. You could try to program some kind of tunnel vision. Like the beginner player who doesn't notice the bishop hiding down in the corner when he hangs his queen out to dry. You might also consider giving the AI a chance to "forget" to look ahead in some situations. Lower level players often get wrapped up in what they perceive as a good combination and when the opposing player does something unexpected with a non-obvious purpose they often ignore it and plow ahead. The same thing could be down for lower level AI in RTS games. Most bad players given time will build everything. Their problem is they don't have an optimized build structure, defense/offense strategy etc. They also get distracted and sometimes focus on something and forget about things. What they don't do is just stop at building mid-tier units. Which is often what lower levels of AI does. They make clicking mistakes where they click a wrong unit, or forget to select a unit in a group or things like that. they get wrapped up in attack or defending and forget to keep building/research. AI doesn't usually do this.
These are the mistakes that AI needs to simulate. It shouldn't be hard. Just play a bunch of games against rank beginners and look at the kinds of mistakes they make then have the AI make similar mistakes. Anyone who wants to build a better AI for a game needs to spend some time observer real players of various levels and see what makes them that level. It wouldn't be perfect but using percentages to simulate real mistakes is much better than cheating AI or AI so ridiculously stupid your dead grandmother could beat it.
Re:Cheating AI (Score:3, Insightful)
No, it's not.
The enemy AI can only see you over long distances if they happen to look in your direction through either binoculars or a scope and if you can't see them they can't see you, even through bushes.
I only managed to play Crysis for a short time before the lack of immersion killed it for me and the enemy targeting AI was the main problem.
Do a short test. You wear a black suit and sit in a dense forest. Your friend wears neon red and stands in the middle of an empty field. Even if there's a clear line of sight between you two, chances are you can see him and he can't see you.
Crysis is a POS, it's pretty but the gameplay is grade A crap. MGS managed to have a believable AI for stealth gameplay more than 10 years ago. It's sad that Crytek burned through $30m for this joke.