Game Design: Theory & Practice- P7 ppsx

30 262 0
Game Design: Theory & Practice- P7 ppsx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 9 Artificial Intelligence “I’d basically watch the game play until I saw the AI do some - thing stupid, then try to correct that and repeat ad infinitum. Over a long enough period that produced a pretty darn good AI. I have always tried to teach the AI the same successful strat - egies that I use in playing a game.” — Brian Reynolds, talking about the creation of the artificial intelligence for his games Civilization II and Alpha Centauri 158 TEAMFLY Team-Fly ® A rtificial intelligence can mean a variety of different things in different con - texts. In an academic context, artificial intelligence is sometimes defined as a system that can reliably pass what is called the Turing test. In the Turing test, a human is presented with a computer terminal into which he can type various sentences and can then see responses printed on the screen. If this user believes that the responses are provided by a human, even though they were actually provided by the computer, then that computer would have passed the Turing test and could be said to have artificial intelligence. One could apply a similar test to computer games. If one is playing a game of Unreal Tournament and cannot tell if the opponent one is playing against is a human opponent or a ’bot, then one could say that the game passes a limited ver - sion of the Turing test and therefore possesses some sort of artificial intelligence. However, in actual practice, even if the game had failed that test, people would have said that the game has artificial intelligence, just not really good artificial intelligence. When game developers talk about artificial intelligence, they do not mean the computer’s ability to trick the player into thinking he is playing against actual human opponents. Instead, game developers refer to whatever code is used to control the opponents the player battles as artificial intelligence. How the game reacts to the player’s actions is determined by the game’s AI. The reactions of the game may be completely random or completely logical; in either case the code which controls those reactions is referred to as the game’s artificial intelligence. Consider a game like Centipede. The AI for this game is completely predict - able, with the various insects moving in predetermined patterns, with a small Chapter 9: Artificial Intelligence 159 If a player plays a game of Unreal Tournament and cannot tell whether the opponent is a ’bot or a human, the ’bot’s artificial intelligence has passed the Turing test. amount of randomness thrown in. Some people would say that the game does not really have any AI. Indeed, the behaviors of the creatures in the game are exceed - ingly simple to implement. But at the same time, the game provides a great deal of challenge for the player. The difficult part of creating the AI for a game like Centi - pede lies entirely in the design of those creatures’ behaviors, coming up with the movement patterns that will provide an interesting challenge for the player. The AI is more design than implementation. Tetris, perhaps, is an even more extreme example. The only AI the game could be said to have is the random number genera - tor that determines which piece will drop into the play-field next. Yet Tetris is designed such that this is the only AI the game needs. The reader may be wondering why I am talking about game AI in a book about game design. Surely AI is a programming task, and since this book is not about pro - gramming, the discussion of AI contained in this chapter may seem out of place. But determining what the AI will do and actually programming that behavior are two fairly distinct tasks. The first primarily involves creativity and the second con- sists of a whole lot of hard work. A game’s designer should be intimately concerned with making sure the game’s AI behavior is as well conceived as possible and per- forms the actions most likely to provide the player with a challenging and compelling gameplay experience. Part of designing a good game is designing good AI for that game, and a designer who just leaves the creation of the AI up to pro- grammers better hope that they are good AI designers. If they are not, the game will likely not be much fun to play. If a computer game is like improvised theater, where the player gets to be direc- tor of the primary character or group of characters, then all of the other actors in the play are controlled by the artificial intelligence. As the game’s designer, you want to direct those AI-controlled actors to create the most stimulating experience possi - ble for the player. These AI agents are not just the opponents the player might battle, but also any characters with which the player interacts. How will a town full of people behave? How will they react to the player’s actions? Designing the AI is a big part of designing a game. Goals of Game AI Players have different expectations of the AI they find in different types of games. Players do not expect much of the AI in an arcade game like Centipede or a puzzle game like Tetris. As I have discussed, these games provide plenty of challenge to the player while using various simple-minded or outright stupid opponents. In a wargame like Close Combat, however, players expect a lot more from the intelli - gence of the opposing forces. In an RPG, players expect to move into a simulation of a living world, where characters move around in a town more or less “realisti - cally.” In a game like The Sims, the AI more or less is the game; with weak AI the 160 Chapter 9: Artificial Intelligence game would simply not be worth playing. So different games provoke different expectations in the player of how smart the AI agents in those games need to be. However, we can still construct a general list of goals for any computer game AI, goals which change in importance as the design goals for a given game vary. Challenge the Player Providing a reasonable challenge for the player must be the primary goal for AI in any computer game. Without setting up a challenge of some sort, a game becomes unchallenging and therefore too easy to defeat. Worse still, a game that provides no challenge stops being a game entirely and becomes more of an interactive movie. In a classic arcade game like Robotron 2084 or in a first-person shooter like Doom, the challenge mostly comes from the player being overwhelmed by adver - saries, and by the powerful abilities those adversaries have. For instance, in my oft-used example of Centipede, the bugs can kill the player by touching him, while the player must shoot the creatures in order to kill them. This puts the player at something of a disadvantage. The fact that there are multiple insects attacking the player at once does not help matters. As a result, the AI for these creatures can be fairly simple and predictable, yet the player is still challenged by them. The same imbalance holds true in Doom, where the player may run out of ammo but his enemies never do, where the player is much more helpless in the dark while the enemies can detect the player just as easily as in the light, and where often the enemies, such as flying creatures, can go where the player cannot. The Chapter 9: Artificial Intelligence 161 The Sims’ success is completely dependent on the strength of its artificial intelligence. fact that the creatures far outnumber the player also tends to compensate for the reality that none of the creatures is very smart. The AI in Doom has to appear more sophisticated than the Centipede insects because the Doom world seems more real than the Centipede world, as I will discuss in a bit. The fact remains that primarily the AI provides a challenge for the player by being more powerful and numerous than the player. Creating a challenging AI for a real-time strategy game like StarCraft is an entirely more difficult proposition. The expectation in games of this sort is that the player is competing with someone equivalent to him in strength. In your average real-time strategy game, both sides have a large number of troops to manipulate and the ability to build more as needed. Both sides usually need to mine a resource of some kind and use that to build more structures or troops. Basically, the AI in an RTS has to do everything the player does and seem smart while doing it. Often the AI is given an advantage by being able to see the entire level while the player can - not, and possibly having a larger number of starting units, an easier method for obtaining more, or a bigger pool of resources from which to draw. Nonetheless, cre - ating a challenge for a player in an RTS game is quite difficult since it requires the AI to plan the movement of the units beyond the individual unit level, making the units appear to work collaboratively, as a player would use them. The difficulties presented in creating a challenging AI for an RTS game are only magnified in a turn-based strategy game such as Alpha Centauri. Here the AI is supposed to operate just as the player does. Of course turn-based strategy games are some of the most thought-intensive games available, so that only amplifies the problem of creating a compelling opponent AI. Furthermore, the computer does not get to benefit as much from its extremely fast processing power; since the game is 162 Chapter 9: Artificial Intelligence In a classic arcade game like Robotron 2084, the challenge comes from the sheer quantity of opponents the player must fight. turn-based, the player has as long to think about a move as he likes. Often turn- based strategy AIs create a challenge for the player by cheating in various subtle ways, though I would certainly be the last to accuse any particular game of doing so. Regardless of the game type, the AI must present the player with an interesting challenge. Without good AI, a game may become similar to playing chess with your (much) younger brother: somewhat pointless. The difference is, when you play chess with your kid brother, you hope to teach him the nuances of the game so that one day he may become a good player. You may also enjoy socializing with him, making an otherwise pointless game of chess worth it. Sadly, the computer game AI you battle has no hope of improving and is woefully inadequate when it comes to providing companionship. In order for a game AI to justify its existence, it must provide the player with a challenge. Not Do Dumb Things AI for a computer game must not appear overly stupid. Players love laughing at AI when it does something completely foolhardy. Nothing breaks a player’s suspension of disbelief more than when an AI agent fails to navigate around a small obstacle such as a fire hydrant or a tree, or when an agent charges right off a cliff to its doom like a lemming. To the player, it is completely obvious what the AI should do in each situation. But what may look obvious to the player can actually be a fairly complex action for the agent to perform or understand. Nonetheless, for the game to avoid becoming a laughingstock, the game’s AI must have a solid mastery of what seems obvious to human players. Chapter 9: Artificial Intelligence 163 Developing a challenging AI for a turn-based strategy game such as Alpha Centauri can be quite difficult since the player is supposed to be fighting opponents with roughly the same strengths and weaknesses as himself. The number of dumb things the AI will be able to get away with has a direct relationship to what sort of intelligence the AI is supposed to represent. For instance, in my first-person shooter Damage Incorporated, the player is supposed to be almost exclusively battling human opponents. In Marathon 2, however, the player is battling a variety of alien species mixed with some robots. The enemies in Marathon 2 are able to get away with appearing stupid since they are non-human creatures. In Damage Incorporated, conversely, since the enemies are all humans they must look much smarter. For another example, in Damage Incorporated, according to the game’s story and the appearance of the levels in the game, the action is supposed to be transpiring in a real-world environment. On the other hand, Centipede 3D takes place in a whimsical fantasy world that bears only a tangential relationship to the real-world. Therefore, while the guards in Damage Incorporated need to appear to be tracking the player like real human soldiers would, in Centi - pede 3D it is less absurd that the centipedes are unable to make a beeline for the player and instead have to wind back and forth between mushrooms. AI stupidity is acceptable relative to the type of world the computer game is supposed to represent. Be Unpredictable Humans are unpredictable. That is part of what makes them good opponents in a game. This is one of the primary reasons that people enjoy playing multi-player games; a skilled person will be challenging to fight in a way a computer never will. A large part of that is the unpredictability of a human opponent. The same should be true of the AI opponents in a computer game. When the game gets to the point 164 Chapter 9: Artificial Intelligence When fighting aliens in a game such as Marathon 2, the player has lowered expectations of how smart these enemies will be. where the player feels with certainty that she knows exactly what the enemy forces are going to do at any given second, the fun of playing the game quickly wanes. Players want the AI to surprise them, to try to defeat them in ways they had not anticipated. Certainly multi-player games still have the advantage of including a social component, which is a major factor in their success, and the AI in your game will never be able to be a friend to the player in the same way another human can. But if you cannot provide the social component of multi-player games, you can at least strive to make the AI agents provide much of the same challenge and unpre - dictability that a human opponent can. In all art, the viewer wants to see something she had not been able to anticipate, something that challenges her expectations. When, within the first ten minutes, you know the exact ending of a movie, book, or play, a big part of the thrill of experi - encing that work is removed. The same is true for computer games. Of course, games can surprise players with their predetermined story, or what sort of environ- ment the next level will take place in, or what the big boss robot will look like. But if the AI can also contribute to this unpredictably, the game gains something that no other component of the game can provide: replayability. Players will keep playing a game until it no longer provides them with a challenge, until they no longer experi- ence anything new from playing the game. And an AI that can keep surprising them, and thereby challenging them, will help keep their interest high. Successful unpredictability can take many different forms in games. It can be as simple as the random number that determines what piece will drop next in Tetris. Surely this is a very simple case, and optimally we would hope many games could Chapter 9: Artificial Intelligence 165 The only AI Tetris needs is a random number generator. Pictured here: classic mode in The Next Tetris. provide deeper unpredictability than that. But at the same time, one must realize that for Tetris, it is the perfect amount of unpredictability. If players knew what piece was coming next, the game would lose a lot of its challenge. Indeed, with the “next” feature on (which displays the next piece to drop on the side of the screen) the game becomes significantly easier. Pure randomness is often a really good way to keep the player interested in the AI, to make them wonder, “What’s it trying to do?” when in fact it is just being random. The randomness in Tetris provides the unpredictability required to keep the player challenged for hours. Sometimes the goals of computer game AI can get confused, and in a quest for the holy grail of realism a designer or an AI programmer can end up making a very dull opponent for a game. Sure, the agent always makes a decision which “makes sense” given its current situation; it may even make the decision most likely to win the current battle. But if that logical decision is completely obvious to the player, how much fun is it going to be to fight that AI? If every time you run into a room in a first-person shooter, the Orc you find there is going to spin around, heave its club above its head, and charge at you while swinging wildly, the next time you play that room the situation will be much less challenging. What if sometimes the Orc is star- tled by the player’s sudden arrival? Then the Orc might flee down the hall or go cower in a corner. What if sometimes the Orc decides to hurl his club at the player instead of trying to use it as a melee weapon? That would certainly provide enough spice to keep the player on his toes. You must remember that each human being is different and that many humans are known to act irrationally for any number of rea- sons. That irrationality keeps life interesting. If the player is battling humans or human-like monsters/aliens in a computer game, a little irrationality will result in making the opponents seem that much more real, believable, and interesting to fight. “Fuzzy logic” is one method AI designers and programmers may try to use to keep the AI agents unpredictable and interesting. Essentially, fuzzy logic takes a logical system and inserts some randomness into it. In fuzzy logic, when the AI is presented with a given situation, it has several worthwhile courses of action to choose from instead of just one. Say the player is at a certain distance with a certain weapon while the AI agent is at a certain health level and is equipped with a certain amount of weaponry. There may be three reasonable things for the agent to do in this case, and they can each have different numerical values or “weights” represent - ing how good a choice each is. Say that running up and attacking the player makes a lot of sense, so it rates a five. Doing a threat display in order to frighten the player makes a bit of sense, so it rates a two. And maybe trying to circle around the player in order to disorient him is also plausible, so it rates a three. Using these different weights, the agent can simply randomly pick a number from 1 to 10 (the total of the weights). If less than or equal to 5, the agent will run up and attack. If 6 or 7, the agent will try to frighten the player. And if 8 through 10, the agent will do its best 166 Chapter 9: Artificial Intelligence to disorient the player. The weights represent the chance that the AI will make a given decision. If the AI has enough different plans at its disposal, the player will never be able to know exactly what the AI will do, thereby making the AI unpre - dictable. In the final analysis, basing AI decisions on randomness makes the agent look like it is performing complex reasoning when it is not. The player will never know that the AI in question just picked its action randomly. Instead, if the agent’s action does not look too stupid, the player will try to imagine why the AI might have chosen to do what it did, and may end up thinking the agent is pretty sly when really it is just random. Of course, the unpredictability of an AI agent in a game must not conflict with the other AI goals I have listed here. If an agent is so busy being unpredictable that it cannot put together a solid plan of attack against the player, it is not going to be much of a threat to the player and he will not be challenged. Ideally, unpredictabil - ity enhances the challenge the AI presents, instead of proving a detriment. If the AI randomly chooses to do something completely foolish when what it was doing was about to lead to victory, the player cannot help but wonder, “Why would the AI do such a stupid thing?” When working on the behaviors of the creatures in a game, it is always important to keep an eye on the bigger picture of what that AI is trying to accomplish. Assist Storytelling Game AI can be used to further a game’s story. For example, in an RPG, a player may travel to a certain town which is home to a number of fearful residents who dread the arrival of outsiders. If the player only observes these people, they can be seen to be navigating the town, going to the stores, restaurants, and factories just as people in a real town would. This sets the scene for the town and makes it seem real to the player. But whenever the player approaches these people, they turn away, fleeing to safe areas to avoid interacting with the player. Why is this? What does it say about the town and the people who live there? Why are they frightened? The player wants to know why, and will start exploring the game’s story as a result. Eng - lish teachers are notorious for telling their students that it is better to show than to tell. This is especially true in a visual medium such as computer games. Instead of just seeing that the town’s inhabitants are frightened of strangers in a cut-scene, a properly designed AI can actually show the player this interesting information. Even the adversaries that a player might fight in a battle can be adjusted to aid in the storytelling process. Suppose that in a wargame the player is supposed to be fighting a general who is known for being compassionate about the welfare of his troops, perhaps more than is logical in a combat situation. The player could send in a few snipers to pick off several of the opposing force’s troops that are serving as guards along the border between two contested areas. If the AI for the enemy Chapter 9: Artificial Intelligence 167 [...]... and appreciate the game s aesthetic value even if the gameplay is poor, but a non-programming player is not going to appreciate sophisticated AI if the game that features it is not any fun to play AI Agents and Their Environment Computer game AI cannot be designed or developed in a vacuum For a game AI to turn out well, it needs to be developed in close association with the game s gameplay and the environments... connection between filling the game with ambient life and using the AI to tell the game s story Creating these inhabitants does a lot to establish the setting for your game, and setting is a key part of telling any story But ambient life in a game goes beyond just establishing that setting; it helps make the player feel less lonely in the game- world How many times have you played a game where you felt like... subtly different depending on how the player played the game Using AI to spice up and vary the story from game to game may make telling a story much more difficult, but what it can add to the game s non-linearity and replayability is enormous Create a Living World In many games, the AI does more than just provide a threat and a challenge to the player A game may even include AI agents that the player does... company, Boffo Games, which produced the lovely The Space Bar Currently, Meretzky is involved with Internet game company WorldWinner.com Of late, adventure games have fallen out of favor with publishers, game audiences, or some combination of both One cannot help but wonder: what happened to the adventure game fans that made Infocom such a huge success? What initially attracted you to computer games? In... player—many of the best games really do present well-designed computer opponents While multi-player games provide many avenues for interesting gameplay design and production, a large segment of the gaming population is still going to desire single-player games Solitaire games provide a unique experience, and the game s AI is crucial to making that experience as fun as possible It is the designer’s responsibility... attributes that a game s AI needs to have, I did not list “be a respectable, academic-quality artificial intelligence.” The AI for a game only needs to be good enough to challenge the player while not appearing overly foolish in its actions In his fascinating Game Developer’s Conference talk “Who Buried Paul?” Brian Moriarty discussed the concept of “constellation” in games This theory is of particular... the Infocom philosophy at the time was to do a mixture of games aimed at our core audience—the Zork games and Enchanter games, for instance—along with a few more experimental games aimed at pushing the envelope creatively and attempting to expand the audience for interactive fiction Another example of this latter category were the “junior level” games like Seastalker and Wishbringer, which were an attempt... Independent Games Festival But for the most part there’s nothing like a Blair Witch Project or a Crying Game that the computer games industry can really point to 186 Chapter 10: Interview: Steve Meretzky So, I think without an avenue for that kind of more experimental game, and with publishers being even more conservative than in other industries, the bottom line is publishers want the “safe game. ” And... game prematurely Nothing frustrates a player more than dying because of faulty teammate AI In a game with teammates, such as Damage Incorporated, the failure of the AI agents to work as the player expects seriously impedes the player’s ability to play the game One can take a couple of lessons away from the problems I had with the AI implementation on Damage Incorporated The first is to never do a game. .. Infocom’s games were quite unique; so much so that the company preferred to call them something else entirely: interactive fiction Infocom’s titles were totally separate and distinct from the arcade game clones and derivatives that so many other computer game companies were publishing at the time Infocom’s interactive fiction appealed to an entirely different and more sophisticated group of computer game . game. Goals of Game AI Players have different expectations of the AI they find in different types of games. Players do not expect much of the AI in an arcade game like Centipede or a puzzle game. fascinating Game Developer’s Conference talk “Who Buried Paul?” Brian Moriarty discussed the concept of “constellation” in games. This theory is of particular relevance to game AI. Roughly stated, the theory. computer game. Without setting up a challenge of some sort, a game becomes unchallenging and therefore too easy to defeat. Worse still, a game that provides no challenge stops being a game entirely

Ngày đăng: 01/07/2014, 17:20

Mục lục

    Welcome to Sterling Software

Tài liệu cùng người dùng

Tài liệu liên quan