Sponsored By

Analysis: Game AI & Our Cheatin’ Hearts

In this in-depth Gamasutra design analysis, Maxis designer Soren Johnson (Spore, Civilization IV) addresses the careful balance between smart AI and player perception that the game is cheating.

Soren Johnson, Blogger

September 14, 2009

8 Min Read

[In this design analysis, first published in the May 2009 issue of Game Developer magazine, Maxis designer Soren Johnson (Spore, Civilization IV) addresses the careful balance between smart AI and player perception that the game is cheating.] The designers of Puzzle Quest have a frustrating burden to bear – everyone thinks they are a bunch of dirty cheaters. The game centers on a competitive version of Bejeweled, in which players duel with an AI to create the most “match-3” colored patterns. The problem comes from how the pieces on the gameboard are created - when, for example, a column of three green orbs is lined up and removed from play, new pieces fall in to take their place. However, sometimes, these three new pieces happen to be of all the same type, which means that a new match is automatically made, and the player scores again. The odds of such a result are low (around 2% for getting three of the same colors in a row), but they are still high enough that a player will see it many times with enough games played. Of course, the AI is playing the same game, so the player will see this lucky match fall into the enemy’s lap as well. At this point, human psychology takes over. Because the new pieces are hidden from view, how does the player know that the computer is not conducting some funny business and giving itself some free matches? The human mind is notoriously bad at grasping probability, so many players are convinced that the AI is cheating. The developers have pledged over and over again that everything is fair and even, but whether they like it or not, the player experience has been affected by the simply possibility of cheating. Trust Me Games do not start with a player’s trust – this trust needs to be earned over time. Our audience is well aware that we can make a game do whatever we want under the hood, so the transparency and consistency of a game’s rules contribute significantly to player immersion. The worst feeling for a player is when they perceive – or just suspect – that a game is breaking its own rules and treating the human unfairly. This situation is especially challenging for designers of symmetrical games, in which the AI is trying to solve the same problems as the human is. For asymmetrical games, cheating is simply bad game design – imagine the frustration which would result from enemies in Half-Life warping around the map to flank the player or guards in Thief instantly spotting a player hiding in the shadows. However, under symmetrical conditions, artificial intelligence often needs to cheat just to be able to compete with the player. Accordingly, designers must learn what cheats feel fair to a player and what cheats do not. As the Puzzle Quest team knows, games need to avoid situations in which players even suspect that the game is cheating on them. Cheating is not the same thing as difficulty levels – by which the players are asking the game to provide extra challenges for them. Cheating is whether a game is treating the player “fairly” – rewarding them for successful play and not arbitrarily punishing them just to maintain the challenge. Unfortunately, in practice, the distinction between difficulty levels and cheating is not so clear. Show the Mechanics Fans of racing games are quite familiar with this gray area. A common tactic employed by AI programmers to provide an appropriate level of challenge is to “rubberband” the cars together. In other words, the code ensures that if the AI cars fall too far behind the human, they will speed up. On the other hand, if the human falls behind, the AI slows down to allow the player to recover. The problem is that this tactic is often obvious to the players, which either dulls their sense of accomplishment when they win or raises suspicions when they lose. Ironically, games which turn rubberbanding into an explicit game mechanic often becomes more palatable to their players. For example, the Mario Kart series has long disproportionately divvied out rewards from the mystery item boxes sprinkled around the tracks relative to the riders’ current standings. While the first-place racer might receive a shell only useful for attacking other lead cars, players in the rear might get a speed bullet which automatically warps them to the middle of the pack. These self-balancing mechanics are common to board games – think of the robber blocking the leader’s tiles in Settlers of Catan – and they don’t feel like cheating because the game is so explicit about how the system works. Thus, players understand that the bonuses available to the AI will also be available to themselves if they fall behind. With cheating, perception becomes reality, so transparency is the antidote to suspicion and distrust. Cheating in Civilization Sometimes, however, hidden bonuses and cheats are still necessary to provide the right challenge for the player. The Civilization series provides plenty of examples of how this process can go awry and drive players crazy with poorly-handled cheating. Being turn-based, the developers could not rely on a human’s natural limitations within a real-time environment. Instead, Civilization gives out a progressive series of unit, building, and technology discounts for the AI as the levels increase (as well as penalties at the lowest levels). Because of their incremental nature, these cheats have never earned much ire from the players. Their effect is too small to notice on a turn-by-turn basis, and players who pry into the details usually understand why these bonuses are necessary. On the other hand, many other cheats have struck players as unfair. In the original version of the game, the AI could create units for free under the fog-of-war, a situation which clearly showed how the computer was playing by different rules from the human. Also, AI civilizations would occasionally receive free “instant” Wonders, often robbing a player of many turns of work. While an AI beating the human to a Wonder using the slow drip of steady bonuses was acceptable, granting it the Wonder instantly felt entirely different. How a cheat will be perceived has much more to do with the inconsistencies and irrationality of human psychology than any attempt to measure up to some objective standard of fairness. Indeed, while subtle gameplay bonuses might not bother a player, other, legitimate strategies could drive players crazy, even if they know that a fellow human might pursue the exact same path as the AI has. For example, in the original Civ, the AI was hard-wired to declare war on the human if the player was leading the game by 1900AD. This strategy felt unfair to players – who felt that the AI was ganging up on the human – even though most of them would have followed the same strategy without a second thought in a multiplayer game. In response, by the time of Civ3, we guaranteed that the AI did not consider whether an opponent was controlled by a human or a computer when conducting diplomacy. However, these changes still did not inoculate us against charges of unfairness. Civ3 allowed open trading – such as technology for maps or resources for gold. An enterprising human player would learn when to demand full price for their technologies and when to take whatever they could get – from a weak opponent with very little wealth, for example. We adapted the AI to follow this same tactic, so that it would be able to take whatever gold it could from a backwards neighbor. To the players, however, the AI’s appeared to be once again ganging up against the human. Because the AI civs were fairly liberal with trading, they all tended to be around the same technology level, which led the player to believe that they were forming their own non-human trading cartel, spreading technologies around like candy (or, in the parlance of our forums, “tech-whoring”). Perception is Reality Once again, perception is reality. The question is not whether the AI is playing “fairly” but what is the game experience for the player? If questions of fairness keep creeping into the player’s mind, the game needs to be changed. Thus, for Civ4, we intentionally crippled the AI’s ability to trade with one another to ensure that a similar situation did not develop. The computer is still a black box to players, so single events based on hidden mechanics need to be handled with great care. Sports game developers, for example, need to be very sensitive to how often a random event hurts the player, such as a fumble, steal, or ill-timed error. The dangers of perceived unfairness are simply too great. Returning to our original example, the developers of Puzzle Quest actually should have considered cheating, but only in favor of the player. The game code could ensure that fortunate drops only happen for the human and never for the AI. The ultimate balance of the game could still be maintained by tweaking the power of the AI’s equipment and spells - changes which appear “fair” because they are explained explicitly to the player. The overall experience would thus be improved by the removal of these negative outliers that only serve to stir up suspicion. When the question is one of fairness, the player is always right.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like