prog: (galaxians)
prog ([personal profile] prog) wrote2008-06-11 10:25 am

Cleverly stupid game AIs

I read a good article in Game Developer last night about building weak AIs (automated opponents) that maximize the fun for the human player. The upshot was a recommendation to rely less on stunting the AI's allowed computation time, or clouding its actions with random variances, and more on having the AI intentionally and subtly providing the player with openings to smack it down.

For example, in a billiards game, a weak-and-dumb AI would just make wild shots. A weak-and-clever AI would calculate precisely the shot necessary to not only barely fail to sink a ball, but also have the cue ball end up in a spot where the human can follow up with an easy shot. It can look quite natural, when done correctly. You wouldn't want to do this on every turn, but you might want it to happen more often if the computer player starts winning. The article's author apparently wrote this very thing for a commercial project.

The article also referenced a chess program for PCs named Fritz, which pioneered this strategy for computer chess AIs. Historically, Chess AIs' difficultly levels are simply a factor of how long they're allowed to analyze the board and thumb through look-ahead positions. At weaker levels, there's a drop-dead timer on their thought process, and when it ends they just make the best move they happened to come across by then - which can often be a transparently terrible move.

Fritz, on the other hand, when set to a gentle difficultly level, plays a strong game but keeps an eye on how well the human is keeping up. If it's falling behind, Fritz will start intentionally making moves that aren't stupid, per se, but definitely leave openings for the human to grab a positional advantage. When (and if!) the human catches on and strikes at the opening, Fritz will resume playing for keeps.

There were other examples specific to Poker (weak players tend to fold when someone else makes a big raise, and so should weak AIs) and even first-person shooters (bad guys that have the "bad luck" to break from cover just as the player's crosshair is panning over them). I really like this.

[identity profile] kahuna-burger.livejournal.com 2008-06-11 04:55 pm (UTC)(link)
Heh, this kind of reminds me of a link you had a while back about "how to cheat at kids' games" with the point of cheating be to give the kids the win regularly. I think the HoMM series could have benifited from this sort of thinking - on the easy levels it was barely worth finishing a game because your advantage got proportionally larger as things progressed. But the harder levels were too punishing at the outset for me to enjoy.

[identity profile] chocorisu.livejournal.com 2008-06-11 06:42 pm (UTC)(link)
It's definitely more interesting to model an AI agent slipping up rather than just being stupid. Hard to get right though, especially in action games, cause there's always that danger of feeling like the computer is screwing with you. You want that sense of fiero from winning a fair fight and--for me, at least--I get none of it when I sense the computer is holding back. Be very cautious of adaptive difficulty for that reason.