Game AI Pro 360: Guide to Character Behavior
eBook - ePub

Game AI Pro 360: Guide to Character Behavior

  1. 150 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Game AI Pro 360: Guide to Character Behavior

Book details
Book preview
Table of contents
Citations

About This Book

Steve Rabin's Game AI Pro 360: Guide to Character Behavior gathers all the cutting-edge information from his previous three Game AI Pro volumes into a convenient single source anthology that covers character behavior in game AI. This volume is complete with articles by leading game AI programmers that focus on individual AI behavior such as character interactions, modelling knowledge, efficient simulation, difficulty balancing, and making decisions with case studies from both commercial and indie games.

Key Features

  • Provides real-life case studies of game AI in published commercial games


  • Material by top developers and researchers in Game AI


  • Downloadable demos and/or source code available online


Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Game AI Pro 360: Guide to Character Behavior by Steve Rabin in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Information

Publisher
CRC Press
Year
2019
ISBN
9780429619656
Edition
1

1

Infected AI in The Last of Us

Mark Botta
1.1Introduction
1.2The Infected
1.3AI System
1.4Skills and Behaviors
1.5Conclusion
References

1.1 Introduction

In The Last of Us a fungal infection has devastated human beings. The pandemic corrupts the mind and has left most of the population grotesquely disfigured and relentlessly aggressive. The survivors have been forced to struggle not only against those overcome by the fungus (known as the Infected) but also against predatory groups of survivors (known as Hunters). This chapter will focus on the AI behind the Infected. Subsequent chapters will discuss the AI for Hunters and buddy characters.
It was our goal to make the Infected feel fundamentally different than Hunters, despite the fact that they use the same AI system. This was done with a modular AI architecture that allows us to easily add, remove, or change decision-making logic. This allows us to create characters that interact with the world in highly varied ways while keeping the code as simple as possible. Simple code is more maintainable, which is crucial when rapidly iterating on new ideas. Developing the Infected required continuous experimentation to discover what worked best. The more quickly new ideas were implemented, the sooner the designers were able to provide feedback. Keeping that cycle of refinement short enabled us to make the Infected feel grounded, entertaining, and believable.
The best way to achieve these goals is to make our characters not stupid before making them smart. Characters give the illusion of intelligence when they are placed in well-thought-out setups, are responsive to the player, play convincing animations and sounds, and behave in interesting ways. Yet all of this is easily undermined when they mindlessly run into walls or do any of the endless variety of things that plague AI characters. Not only does eliminating these glitches provide a more polished experience, but it is amazing how much intelligence is attributed to characters that simply don’t do stupid things.

1.2 The Infected

The Infected are humans who have succumbed to the parasitic Cordyceps fungus [Stark 13]. The infection ravages the body, leaving no trace of personality, compassion, or even self-preservation. The Infected are driven only by the instincts of the fungus.
Most survivors exist in prisonlike quarantine zones under martial law, but some choose to live outside of the quarantine zones, where they are free but constantly at risk of encountering the Infected or predatory gangs of Hunters.
We wanted the Infected to feel fundamentally different than the Hunters. Hunters work in groups, communicate with words and gestures, and protect each other. The player can see that their cold-blooded brutality is a means to survive. In contrast, the Infected seem chaotic and alien.
Table 1.1 summarizes the four types of Infected that represent the progression of the infection. Runners are the most common type. They are fast and often attack in uncoordinated groups. They can see and, like all Infected, their hearing is far more sensitive than that of the Hunters, making them just as effective in a dark room as they are on a sunlit street. Stalkers are similar to Runners but hide in dark areas and ambush prey. Clickers are visibly disfigured by the infection, with masses of fungus distorting their features and leaving them blind. They have developed a type of echolocation to compensate. They are slower than Runners but have a deadly frenzy attack and ignore melee attacks that don’t use weapons. Bloaters are highly disfigured, blind, slow, and heavily armored. They grab and kill any character within reach, making melee attacks ineffective. They throw growths from their bodies that burst into disorienting clouds of irritating dust.

1.2.1 Senses

Our characters rely on their senses to reveal enemies and distractions in their environment. They track how and when they sense each entity and focus on the one that is the most threatening. All Infected, even Runners and Stalkers, rely primarily on hearing.
The sensory system does not reason about the actual audio heard in the game. Instead, logical sound events are generated specifically for this purpose. This gave the game designers more control, allowing them to specify which sounds are heard at what range by which character type. It also allowed sound designers to add or modify the game’s audio without impacting the AI.
Table 1.1 Characteristics of Infected Character Types
Images
Wherever possible, we tried to correlate the logical sound events with actual audio, so that the player would be able to understand (and predict) the reactions of the Infected. There were exceptions, however. In particular, we wanted the AI to be able to sense nearby stationary targets, so we created a logical breathing sound that propagates over a very short range but has no audio.
Logical sounds are broadcast over a radius set by the designer, and any character within that radius—whether Infected or not—can hear it. Of course, not all characters hear equally well. We wanted the Infected to hear roughly six times better than the Hunters. We also wanted to be able to vary their hearing sensitivity based on their current behavior. For example, the Infected do not hear as well when they are unaware of the player. This makes it easier for the player to be stealthy, which slows the pace of the encounter, giving the player more opportunity to observe and plan. Thus, for a particular character type in a particular behavior, the radius of a logical sound is multiplied by a tunable value to give the effective radius within which that character will hear the sound.
Similar to actual audio, logical sounds are partially occluded by walls and obstacles. This was done to prevent the characters from hearing through walls as well as to reinforce the player’s natural tendency to keep obstacles between them and the Infected. Each time a logic sound event is broadcast, rays are cast from each character within the sound radius to the source of the sound to determine the level of occlusion. The logical sound is broadcast to all characters in range that are not completely occluded.
In order to further differentiate the Infected from the Hunters, we wanted them to be more difficult to approach stealthily. It is a common video game trope to communicate stealthy movement to the player via crouch animations: when crouching, the player can approach another character from behind without being discovered. In The Last of Us, this was true of Hunters, but approaching the Infected with impunity while crouched made them feel considerably less dangerous. Our solution was to scale the broadcast radius of logical movement sounds with the speed of the player. This allows approaching the Infected more quickly from farther away but requires moving more slowly at melee range. To communicate this to the player, the Infected enter an agitated state when they start to hear noise, which gives the player a chance to respond before being discovered.
This raises an important point. Communicating the intent of the characters to the player is vital. We rejected some game features simply because they could not be communicated well. For example, Clickers make a barking sound that is an ornamental remnant of a more ambitious design. We originally wanted them to use a type of echolocation to build a local model of the environment (similar to how bats hunt and navigate). Each time that they barked, we would update their mental model of the local area by turning their vision on momentarily. This gave the character a sensory snapshot of threats in the world, but it did not communicate well and confused players that were seen by a blind character. We considered giving the bark a visual effect like a ripple of distortion washing over the environment but ultimately decided that this seemed too unrealistic. In the end, we abandoned this approach because it was complex and difficult to convey to the player.

1.2.2 Distractions

When Hunters see the beam of a flashlight or are hit by a brick, they can infer that somebody is nearby. The Infected lack this insight and react only to the stimulus itself. For example, they are drawn to the sound of a thrown object landing rather than deducing the existence of the character that threw it. This response empowered the player to manipulate the Infected and made bricks and bottles as valuable as any weapon.
This response was consistent with their instinctive behavior but it trivialized some encounters. This was particularly problematic when the player used a Molotov cocktail. The sound of the breaking bottle would attract all nearby Infected who would follow each other into the flames, become engulfed, and die. This was entertaining, but much too easy. We solved this by limiting the number of characters that could be affected by the flames. Molotov cocktails are expensive to craft and should be very effective, but not so effective that they take the challenge out of the game.
The Last of Us also allows players to create smoke bombs, which are used to break line of sight and mask the movement of the player. In principle, these should be ineffective against the Infected because they rely so heavily on their hearing, but again, that would take the fun out of the game. Instead, we had them occlude hearing as well as vision. Thus, after being attracted by the detonation of a smoke bomb, the Infected enter the cloud and become essentially blind and deaf. The player is rewarded with the opportunity to flee or to move among the distracted Infected strangling Runners and dispatching Clickers with shivs.

1.3 AI System

Our AI system makes a distinction between the high-level decision logic (skills) that decides what the character should do and the low-level capabilities (behaviors) that implement those decisions. This separation allows characters with different high-level skills to reuse the same low-level behaviors. For example, movement is encapsulated in the move-to behavior that is invoked by many different skills. Furthermore, in this behavior, the decision of where to go is independent of how the character decides to get there. One character may use the move-to behavior to move stealthily in the shadows, while another charges forward.
Skills decide what to do based on the motivations and capabilities of the character, as well as the current state of the environment. They answer questions like Do I want to attack, hide, or flee? and What is the best place for me to be? Once a decision is made, behaviors are invoked to implement it. For example, if movement is required, the skill may invoke the move-to behavior and then wait for it to succeed or fail.
The move-to behavior attempts to reach the destination using whatever capabilities are available to it. It answers questions like Which route should I take? and Which animations should I play? It generates paths, avoids obstacles, selects animations to traverse the environment, and ultimately reports the results to the parent skill.

1.3.1 Philosophy

As a general rule, characters don’t need complex high-level decision-making logic in order to be believable and compelling and to give the illusion of intelligence. What they need is to appear grounded by reacting to and interacting with the world around them in believable ways. Of course, they also need to avoid doing stupid things. Characters in The Last of Us can see and hear threats and distractions, they can navigate by climbing over obstacles and jumping gaps, they can look around corners, they can respond to fire, and they can search for prey. By building a rich set of behaviors that allow characters to interact with the world and picking appropriate behaviors even in fairly simple ways, we create characters that draw the player into the drama of the moment, which sell the story and make the experience meaningful.
In order to be able to reuse skills as widely as possible, we needed to keep them flexible but well encapsulated and decoupled, so that each skill could be adjusted to fit its particular use without affecting other skills. This was very valuable in the late stages of development. Features changed quickly, and it was important to be able to insulate the rest of the code from unstable prototypes. Our modular approach also made it easy to completely remove any failed experiments without fear of leaving any remnants behind. This allowed us to experiment with major changes to the AI right up to the end of the project. For example, Stalkers were conceived of and implemented only a few months before the game shipped.

1.3.2 Data-Driven Design

One key to keeping the code general was to never refer to any of the character types in code, but instead to specify sets of characteristics that define each type of character. All of the Infected character types share a single C++ class and are differentiated only by the set of skills and the values of the tuning variables in their data files. For example, t...

Table of contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright Page
  5. Table of Contents
  6. About the Editor
  7. About the Contributors
  8. Introduction
  9. 1 Infected AI in The Last of Us
  10. 2 Human Enemy AI in The Last of Us
  11. 3 Ellie: Buddy AI in The Last of Us
  12. 4 Realizing NPCs: Animation and Behavior Control for Believable Characters
  13. 5 Using Queues to Model a Merchant’s Inventory
  14. 6 Psychologically Plausible Methods for Character Behavior Design
  15. 7 Behavior Decision System: Dragon Age Inquisition’s Utility Scoring Architecture
  16. 8 Paragon Bots: A Bag of Tricks
  17. 9 Using Your Combat AI Accuracy to Balance Difficulty
  18. 10 1000 NPCs at 60 FPS
  19. 11 Ambient Interactions: Improving Believability by Leveraging Rule-Based AI
  20. 12 Stochastic Grammars: Not Just for Words!
  21. 13 Simulating Character Knowledge Phenomena in Talk of the Town