1k likes | 1.34k Vues
Technical Issues: Artificial Intelligence Technical Issues: Artificial Intelligence Artificial intelligence can mean a variety of different things in different contexts.
E N D
Technical Issues: Artificial Intelligence • Artificial intelligence can mean a variety of different things in different contexts. • By purist definitions, a game would possess artificial intelligence if a game player cannot distinguish between characters controlled by a human, or by the game itself. • In such a case, the game would be passing a limited version of what is called the Turing test. • In actual practice, however, a game that does not pass this test still has artificial intelligence, just not really good artificial intelligence.
Technical Issues: Artificial Intelligence Screen shot from Unreal Tournament 2003. If you cannot tell if an opponent or teammate is a human or a bot, then the bot’s artificialintelligence has passed the Turing test.
Technical Issues: Artificial Intelligence • Game developers rarely use the Turing test definition of artificial intelligence. • In a game, artificial intelligence refers to the code used to control all non player characters and opponents within a game. • The reactions of the game may be totally random, or totally logical, but the control code is still referred to as the artificial intelligence of the game.
Technical Issues: Artificial Intelligence Even though the opponent control for Centipede (left) and block droppercode for Tetris (right) is simple and scripted, with a random number generator producing some variation, both are still considered to posses a certain amount of artificial intelligence.
Goals of Game Artificial Intelligence • Players have different expectations of the artificial intelligence they find in different types of games. • Some games, like Centipede and Tetris, have very minimal intelligence requirements. • Other games, however, are heavily dependent on good artificial intelligence. If it is weak, the game would simply not be worth playing. • Despite this, there are several general goals for any game artificial intelligence. The importance of these goals depends greatly on the game.
Goals of Game Artificial Intelligence Screen shot from CompuChess. Without strong artificial intelligence, a game of chess might not be worth playing, except for beginners.
Goals of Game AI:Challenge the Player • Providing a reasonable challenge for the player must be the primary goal for artificial intelligence in any game. • There are several ways to provide challenge: • A very sophisticated artificial intelligence. • Outnumbering the player. • Giving opponents abilities and advantages that the player does not have. • Assigning the players teammates or additional obligations that might hold them back. • Cheating. (As long as you don’t get caught!) • Poor game design. (Do not do this!!!)
Goals of Game AI:Challenge the Player Screen shot from Doom II. It created challenges for players by vastlyoutnumbering the player, and providing opponents many advantages (unlimited ammunition, seeing in the dark, flying, and so on).
Goals of Game AI:Challenge the Player Screen shot from Warcraft III. Sometimes, the difficulty in selecting and controlling units in the heat of battle provides an unwanted and frustrating challenge.
Goals of Game AI:Challenge the Player • Creating a challenging and sophisticated artificial intelligence can be quite difficult. • In some games, outnumbering the player and providing additional abilities is not what the player wants or expects. • In such cases, the artificial intelligence must be very good. • Depending on the game genre and game characteristics, the player must be challenged in different ways.
Goals of Game AI:Challenge the Player Screen shot from NHL 2003. It would break player expectations by giving opponents extra abilities or by outnumbering the player. The artificial intelligence must be better to compensate for this.
Goals of Game AI:Challenge the Player Screen shot from Alpha Centauri. Since it is a strategy game, the player expects a strong opponent as the game is very thought intensive. Since thegame is turn based, the game cannot overwhelm the player by processing alone; the player can take their time and think.
Goals of Game AI:Be Realistic • A game should provide artificial intelligence that is appropriate to its setting, story, and characters. • Characters that are supposed to be smart should not do dumb things. • Characters that are supposed to be dumb should not do smart things. • The more human and realistic a character is, the smarter it should behave. • Beast-like, alien, robotic, and undead characters can get away with more stupid actions, depending on the situation.
Goals of Game AI:Be Realistic Screen shot from Quake. The Zombies behave pretty much as one would expect: they lumber towards you and take your shots until they get close enough for an attack. Unless they are blown to bits, they willget up and come back for more, just like real zombies!
Goals of Game AI:Be Realistic • There are some things, however, that are so dumb that nothing should do it. • For example, walking off of a cliff or not being able to navigate around a small obstacle. • In these situations it is obvious to the player what the artificial intelligence should have done. • Unfortunately, players seldom recognize how complex or difficult such obvious actions are to recognize and perform. • To avoid ridicule, the game’s artificial intelligence must have a mastery of what is obvious to human players.
Goals of Game AI:Be Realistic Screen shot from Quake. The ogre was notorious for getting stuck in doorways in many levels with its chainsaw, and not knowing how to get unstuck.To players, this seemed ridiculous, even for an ogre.
Goals of Game AI:Be Realistic Screen shot from Oni. In this situation, Konoko is being chased by Muro. A TCF officer on Konoko’s side has beaten his enemy in the background,and stands over her body for several minutes. Why isn’t he helping me?
Goals of Game AI:Be Realistic • One must be careful, however, to make artificial intelligence too realistic. • Games are often unreal situations set up because they are interesting, not because they are authentic. • For example, if an opponent realizes it has no chance of winning, it should run away indefinitely, which quickly ceases to be fun. • In building good artificial intelligence, one must keep in mind the true goal of the project: building a fun, playable game.
Goals of Game AI:Be Realistic Screen shot from 007 Nightfire. Realistically, the villain should just killJames Bond and be done with it, instead of toying around with him. That wouldn’t make for a very good game though!
Goals of Game AI:Be Unpredictable • Humans are unpredictable. This is part of what makes them good opponents. • The same should be true of the artificial intelligence opponents in a game. • Players want the artificial intelligence to surprise them and use strategies and techniques that are unanticipated. • If the player can predict with some measure of certainty what the game will do, the fun in the game quickly disappears.
Goals of Game AI:Be Unpredictable Screen shot from Starcraft. Strategy games benefit greatly fromunpredictability. It does not take long for a seasoned player to recognize the same strategy over and over again.
Goals of Game AI:Be Unpredictable • Successful unpredictability can take many forms, depending on the game. • Usually, this involves adding some element of randomness to the game’s artificial intelligence. • Could be pure randomness. • Could be a form of selection in which there are several valid choices of action that are chosen from randomly. Weights can be applied to vary the amount of randomness. • In the end, the player will never know the action was random, and will tend to attribute it to some intelligence with a purpose.
Goals of Game AI:Be Unpredictable Screen shot from Unreal Tournament 2003. Opponents can act inan unpredictable fashion through randomly selecting a weapon to use,and use tactics appropriate to that weapon.
Goals of Game AI:Be Unpredictable • Keep in mind that unpredictability should enhance the challenge presented by the artificial intelligence in a game. • If things are so random that the game cannot put together a solid plan for defeating the player, you have gone too far. • Make sure that random choices are still realistic given the scenario. • If an opponent is about to win, and its artificial intelligence randomly selects a poor action, this will seem ridiculous.
Goals of Game AI:Assist Storytelling • The artificial intelligence in non player characters can be used for storytelling in many ways. • Setting mood. • Advancing the plot. • Providing foreshadowing. • And so on. • By telling the story in the game, as opposed to just cut scenes, the player becomes much more involved.
Goals of Game AI:Assist Storytelling Screen shot from Oni. Konoko has just been declared a rogue agent, and civilians encountered reflect this to help establish setting and mood.
Goals of Game AI:Create a Living World • Creating a sterile game world filled with inanimate objects is not going to be a very authenticate reality for the player. • Instead, adding ambient life to a world can do a lot to enhance the experience. • Can be people going about doing their daily business. • Can be birds flying in the sky, or animals or other critters roaming around the ground.
Goals of Game AI:Create a Living World Screen shot from Grand Theft Auto III. This series of games always had avery lively city, full of motorists and pedestrians with interestingbehaviours. Too bad for them!
Goals of Game AI:Create a Living World Screen shot from the Legend of Zelda: The Ocarina of Time. The world is full of lively artificial intelligence agents, including the characters wandering around, animals, and so on.
Goals of Game AI:Create a Living World These artificial intelligence agents can be interacted with in a variety of ways. This is what happens if you attack poultry too often … death by chickens!!!
Artificial Intelligence Tips • Before looking at some of the various techniques employed by artificial intelligence designers and coders, we first provide some general tips. • Some of these are common sense. • Others have come from years of experience, both good and bad. • Unless you have a good reason, it is advisable to follow these suggestions!
Artificial Intelligence Tips:Do Your Homework • There is no “one size fits all” artificial intelligence system. • Different techniques are appropriate for different situations. • The right solution depends on many factors: • The emphasis of AI in the game. • The scheduling and budget for AI development. • The development team make-up and experience. • It is important to determine the needs of your game and the capabilities of your team.
Artificial Intelligence Tips:The Sloped Playing Field • It is generally not advisable to pin all your hopes on creating an artificial intelligence that can compete with human players relying solely on its synthetic intellect alone. • Generally, your artificial intelligence will require an edge to compete with a human player. • By outnumbering the player. • By having superior strength or abilities. • By having additional resources at its disposal. • By having perfect knowledge of the game world. • And so on.
Artificial Intelligence Tips:The Sloped Playing Field Screen shot from Doom II. It makes use of a sloped playing field by vastlyoutnumbering the player, and providing opponents many advantages (unlimited ammunition, seeing in the dark, flying, and so on).
Artificial Intelligence Tips:Use the Environment Wisely • Tune the design of levels to fit limitations of the artificial intelligence, instead of the other way around. • It is incredibly difficult to build artificial intelligence that can handle every level design in an effective and efficient manner. • Levels can be worked to fit with artificial intelligence limitations much easier and with few or no compromises. • Your non player characters and levels have to work together to make a game fun to play.
Artificial Intelligence Tips:Use the Environment Wisely Screen shot from Damage Incorporated. Players had to direct teammatesthrough a 3D environment. Levels had to be redesigned many times beforerelease because of artificial intelligence problems in navigation.
Artificial Intelligence Tips:Use the Environment Wisely • Put smarts into the game environment itself, in addition to the characters. • Have objects in the world announce themselves to non player characters and provide them information and scripts on how to use them. • Embed navigation information in level design so that characters can traverse levels more easily. • By making a smarter environment, the artificial intelligence driving characters does not need to be as sophisticated. • Characters do not need to locate or identify objects or terrain; they broadcast and tell them instead.
Artificial Intelligence Tips:Use the Environment Wisely Screen shot from The Sims. The Sims makes use of smart terrain thatbroadcasts what it offers. For example, the refrigerator broadcasts that it cansatisfy the hunger need and tells Sims how to use it to do so when needed.
Artificial Intelligence Tips:Keep it Simple • In the rush to beef up the artificial intelligence in a game, it is very easy for it to get out of control and too complex. • Ideally, the AI system should let the developers do complex things with a variety of simple parts. • By combining the simple parts appropriately, a variety of interesting and complex behaviours can be provided. • By keeping things simple, the system will be easier to understand, reuse, debug, and maintain.
Artificial Intelligence Tips:Precomputation is Good • Good artificial intelligence can be computationally expensive at run-time. • Scarce resources are also needed for graphics, animation, physics, networking, and other subsystems though. • Precomputation should be used wherever possible to provide good AI cheaply. • Scripting of sequences of actions. • Navigation through game terrain. • Collisions with obstacles.
Artificial Intelligence Tips:Precomputation is Good Screen shot from Thief II. This game uses navigation meshes to help characters navigate terrain. By precomputing these in advance, and usingthem in level design, character artificial intelligence is simpler and cheaper.
Artificial Intelligence Tips:Timeouts and Fallbacks • Nothing looks worse than an artificial intelligence that repeatedly does the wrong thing over and over. • Players will not notice them make a wrong turn, but they will notice continuous collisions with an easy to navigate obstacle. • Every artificial intelligence system should check for success conditions within a reasonable amount of time. • If a timeout occurs, the system should give up and try something different. • At a minimum, it can fall back to interesting idle animations that express its confusion or frustration while a new plan is formulated in the background.
Artificial Intelligence Tips:Timeouts and Fallbacks Screen shot from Grand Theft Auto. Police were notoriously bad at moving around stopped vehicles to arrest the player; they could easily get stuck or run back and forth. Timing out and falling back would have been good.
Artificial Intelligence Tips:Avoid Story Interference • If the artificial intelligence in a game interferes with its story, it must be fixed. • The artificial intelligence system must be aware of game events that are important to telling the story. • This includes conversations, listening to dialog, watching a cut-scene, and solving game puzzles. • The AI system should know it should back off and not get in the way.
Artificial Intelligence Tips:Avoid Story Interference Screen shot from Oni. Konoko was having a conversation with the scientist inthe lab coat when she was viciously interrupted. Unfortunately, she missedthe rest of the story. The guard was punished appropriately.
Artificial Intelligence Tips:Provide Memories • The artificial intelligence characters in a game should remember what has happened to them and others during a game. • They can then change their behaviour and dialog accordingly. • This gives the player a sense that they are living beings with thoughts and feelings. • If the artificial intelligence in a game can learn and adapt from its memories of events, so much the better.
Artificial Intelligence Tips:Provide Memories Screen shot from Quake 3 Arena. Most game characters and bots havememories. If you shoot them and get on their bad side, they rememberit. They will even keep grudges against each other too!
Artificial Intelligence Tips:Variety Through Data • A variety of character behaviours keeps games interesting and entertaining. • Providing code for each behaviour introduces programming, debugging, and testing headaches. • Instead, code should provide one or a small handful of behaviours that are greatly customizable through data. • Designers can then introduce a “new” behaviour by tuning these variables. • This includes awareness, speed, tactics, weapon preference, field and range of view, inventory, strength, abilities, chatter, and so on. • This data should be available to designers to assist in game balancing and adjustments.
Artificial Intelligence Tips:Variety Through Data Screen shot from Unreal Tournament. It provides a wide variety of bot behaviours based on the settings of a few parameters.