<<

USING GLOBAL OBJECTIVES TO CONTROL BEHAVIORS IN CROWDS

A Thesis

Presented in Partial Fulfillment of the Requirements for the Degree Master of Science in the

Graduate School of The Ohio State University

By

Domin Lee, B.S.

*****

The Ohio State University

2008

Master’s Examination Committee: Approved by

Dr. Rick Parent, Adviser Dr. Matthew Lewis Adviser Graduate Program in Computer Science and Engineering c Copyright by

Domin Lee

2008 ABSTRACT

The agent-based and behavioral modeling techniques are effective in many situa- tions; however, with an increase in demand for more complex and realistic behaviors, the problems of scale can quickly become an issue. By adding another set of rules that incorporate the desired behaviors, the rule-based methods can become difficult to manage. This thesis attempts to develop an organizational tool that avoids rule pro- liferation and problems with scale in rule-based systems. Using global objectives to weigh local rules, we look to model a system where behavioral decisions are made, not just at the individual levels, but also at the global levels in the crowds. Consequently, this thesis presents a solution for one requirement of team-oriented crowd behaviors in animation and games: the ability to adaptively generate human-like altruistic be- haviors. The team-oriented crowds refers to a type of crowds where each individual has a membership to a team. And those individuals interact directly and simultane- ously to achieve a global objective. Some of the team-oriented crowds include team sports: football, handball, hockey, basketball, and baseball. ”Altruistic behaviors” are the behaviors where behavioral decisions are made for the global objectives of the crowds. I.e., instead of doing what’s best for each individual, it’s doing what’s best for the crowds. We generate these ”altruistic behaviors” in the team-oriented crowds by applying rules that are weighted appropriately.

ii To Doyoun. . .

iii VITA

January 17, 1976 ...... Born - Seoul, Korea

2000 ...... B.S. Computer Engineering, HanYang University 2003-2004 ...... Graduate Teaching Associate, The Ohio State University 2005-2006 ...... Graduate Administrative Associate, The Ohio State University 2006 ...... FX Technical Director / Motion Cap- ture Studio Lab Assistant, The Ohio State University 2007 ...... Simulation Technical Intern, Animation Studios 2007 ...... Effects Artist, PDI/Dreamworks SKG 2008 - present ...... Effects Artist, Dreamworks Animation Studio

FIELDS OF STUDY

Major Field: Computer Science and Engineering

iv TABLE OF CONTENTS

Page

Abstract ...... ii

Dedication ...... iii

Vita ...... iv

List of Tables ...... vii

List of Figures ...... viii

Chapters:

1. Introduction ...... 1

1.1 Problem Statement ...... 3 1.2 Techniques ...... 4 1.3 Overview ...... 6

2. Background ...... 7

2.1 Crowd Modeling and Animation ...... 7 2.1.1 Behavioral Modeling ...... 8 2.1.2 Agent-based Approach ...... 8 2.1.3 Crowd Simulation in Movies and Games ...... 10 2.1.4 Sports Simulation ...... 12 2.1.5 Pathfinding Algorithms ...... 14

3. Using Global Objectives to Control Behaviors in Crowds ...... 15

3.1 Agent-based Approach for Team-oriented Crowds ...... 16 3.2 Team-oriented Crowds ...... 18

v 3.3 Structure of Crowd System ...... 19 3.4 Behavior Generation ...... 21

4. Setting up a System for Football Kickoff Simulation ...... 33

4.1 Initial Phase of the Simulation ...... 33 4.2 Model ...... 35 4.3 Field Setup ...... 36 4.4 Basic Behaviors ...... 36 4.5 Basic Blocking Routines ...... 39

5. Modifying Individual Behaviors Based on Global Objectives ...... 41

5.1 General Group Behaviors ...... 41 5.2 Blocking Assignments and Pathfinding ...... 42 5.3 Blocking Assignments ...... 43 5.3.1 Determining Opponents ...... 44 5.4 Pathfinding ...... 45 5.4.1 Field of View ...... 46 5.4.2 Heuristic Function and Distance Metric ...... 47

6. Assessment ...... 52

6.1 Agent-based Behavioral System ...... 53 6.2 Blocking Assignments and Pathfinding ...... 54 6.2.1 Different global objectives ...... 55

7. Conclusion ...... 59

7.1 Summary ...... 59 7.2 Future Work ...... 60

Bibliography ...... 62

vi LIST OF TABLES

Table Page

2.1 Examples of behavioral animation in movies and games ...... 9

r 3.1 Possible state variables for the current perceivable environment et . These variables can be retrieved by the agents to decide about their behaviors. These variables are used in computing the distance metric. 26

3.2 Weights used by our distance metric to give more importance to dif- ferent state variables. The weights can be altered depending on the applications...... 31

4.1 Varying attributes make the simulation more realistic ...... 34

r 5.1 State variables for the perceivable environment, et . These variables can be retrieved by the kick returner to decide on its behaviors. These variables are used to compute the distance metric...... 47

vii LIST OF FIGURES

Figure Page

1.1 Agent-based system that uses global objectives to control behaviors in team-oriented crowds ...... 5

2.1 Computer graphics cognitive modeling hierarchy as proposed by Funge et al...... 10

2.2 As the required behaviors increase, ”Brain” in Massive software can rapidly become very complicated and unmanageable...... 11

2.3 Condition based A.I...... 12

2.4 SpirOps crowd system was used as a crowd tool and A.I. middleware in ”Splinter Cell - Double Agent” game ...... 13

3.1 Crowd simulation using an agent-based system that integrates percep- tual and behavioral components for individual and group behaviors. The arrow between the pre-process and real-time process indicates that all the information assigned in the pre-process phase is conveyed to the actual simulation in which the dynamic behaviors are computed for each agent...... 20

3.2 A high-level description of the system in terms of its properties. Au-

tonomous agents with current states, s1...n, are used in the simulation. After the current environment is registered with each agent, different behaviors are assigned based on a heuristic function computed by a distance metric. Following this, the states are updated based on the behavior assignments...... 22

viii 3.3 (a) Average 140-degree binocular vision. (b) Altered vision to simulate the binocular vision of a football player whose vision is impeded by a helmet. The red rectangles are objects that are ”seen”, and the light blue rectangles are objects that are not. (c) An agent can rotate to perceive its environment, and r denotes each region that the agent can see...... 25

r 3.4 The distance metric, D(eoptm, et , og), is computed between the opti- r mum environment, eoptm, and the perceived environments, et , during the simulation using the state variables and the global objectives at time t. The heuristic function examines the distances to determine the subsequent behaviors for an agent using a threshold, τ. The grey area represents the environments at a certain time (t) during the simula- tions...... 30

4.1 During the initial phase of the crowd simulation, individual and group behaviors are assigned along with various attributes...... 34

4.2 (a) Setup in Maya where a particle is instanced by a primitive box; (b) A low-resolution model; and (c) a high-resolution model ...... 35

4.3 Initial setup for the kickoff in football. 10 defenders, Wedge group of 5 players, 5 blockers, and a kick returner ...... 37

4.4 (a) Illustration of a player calculating a direction based on the accel- eration vector of the opposition. (b) Application of impulses at the initial contact. (c) Generation of impulses so that the player can stay in front of its opponent...... 39

5.1 (a) Return to right. (b) The blockers and the defenders engage in blocking. (c) The blockers set up a path to the right by shielding the defenders to the left...... 42

5.2 The global objectives are initially assigned. (a) There are three paths that can be assigned. (b) If the middle path is assigned, the blockers try to open up a running lane in the middle. (c) If the path is to the right, the blockers set up a path to the right. (d) The path to the left is given...... 43

5.3 High-level states of the blocking assignments. The solid black arrows indicate the transition event used to move between each state. . . . 44

ix 5.4 The greedy algorithm is used in the blocking assignments. (a) Initial state where the circles indicate that the blocking assignments have not been made. (b) Two blocking assignments are made wherein each select the closest opponent. (c) The blocking assignments change in realtime as they adapt to the changing environment...... 45

5.5 (a) Average 140-degree binocular vision. (b) Altered vision to simulate the binocular vision of a football player whose vision is impeded by a helmet. The red rectangles are objects that are ”seen,” while the light blue rectangles are objects that are not. (c) A player can rotate to perceive his environment, and r denotes each region that can be seen by the player...... 46

r 5.6 The distance metric, D(eoptm, et , og), between the optimum environ- r ment, eoptm, and the perceived environments, et , is computed during the simulation using the state variables and the global objectives at time t. The heuristic function examines the distances to determine the subsequent behaviors for the kick returner using a threshold, τ . The grey area represents the environments at a certain time (t) during the simulation...... 50

5.7 Our system partitions the initial environment into regions. Once the heuristic function determines that one of the regions has the optimal path, the region is then divided into three new subregions. Our system allows up to three levels of partitions...... 51

5.8 (a) Initial state where the yellow region represents the vision of the kick returner. (b) A running lane through the middle is chosen. (c) Since the middle region is occupied by both the defenders and blockers, so the right running lane is chosen. (d) Both the middle and right lanes are closed, but there is a running lane to the left of the kick returner. 51

6.1 Left: An initial window that is created when the crowd system is first executed. Center: GUI to control different attributes and variables for the simulation. Right: A render of the simulation using high-resolution models...... 53

6.2 Left: Blocking assignments in our football kickoff simulation. Right: Pathfinding algorithm for the kick returner...... 54

x 6.3 A kickoff simulation with the ”return right” global objective. The yellow vision indicates the path that was decided by considering the global objective. The grey vision is the path that would have been the choice of the returner if it was simply decided by examining the current situation...... 56

6.4 A kickoff simulation with the ”return left” global objective. As in the ”return right”, the yellow vision indicates the path that was decided by reasoning about the current situation and the grey vision implies the path that was determined by simply examining the current situation. 57

6.5 A kickoff simulation with the ”return middle” global objective. . . . 57

xi CHAPTER 1

INTRODUCTION

One of many important aspects in portraying animation is to define it similarly with respect to the real world. Having natural crowd behavior often enhance the quality of animation and is becoming a major trend in movies and games. Hence, numerous systems have been developed to produce more natural crowd behaviors.

Agent-based and behavioral modeling techniques are effective in many situations; however, with an increase in demand for more complex and realistic behaviors, the scales of these rule-based systems can quickly become a problem. By adding another set of rules that incorporate the desired behaviors, the rule-based methods can become difficult to manage.

For example, a flock of birds is made up of discrete birds; it seems randomly arrayed and yet is magnificently synchronized [23]. Using three steering behaviors, the flock of birds was successfully produced and the model became the foundation of many agent-based and behavioral modeling techniques (see section 2.1.1 and section

2.1.2 for details on behavioral modeling and agent-based techniques, respectively).

On the other hand, a team-oriented crowd mobilizes itself in a different manner.

Although most of the players in team-oriented crowds behave differently, the main objective remains global. These exhibited behaviors are called ”altruistic behaviors,”

1 and for the most part, they are shown by the players participating in team sports such as soccer, volleyball, baseball, basketball, and football. Most of the behaviors from these activities are likely to favor the entire team rather than the individual players. Instead of introducing another set of rules to produce altruistic behaviors, allowing a second level of control using global objectives can allow a crowd system to avoid rule proliferation.

Thus, we attempt to generate these ”altruistic behaviors” in team-oriented crowds by constructing a system that considers the global objectives that take precedence over the local rules. While behaving according to the assigned rules, a member can recognize a situation that will possibly violate the global objectives, following which the behavior will be interrupted and a suitable action will be taken. This thesis attempts to understand the behavioral decisions that are made, not just at an individual level, but also at a global level.

Motivation

It is difficult to emulate the precise behaviors that are observed in the players par- ticipating in team sports. This is because the individual players behave differently.

However, all of them maintain the perspective of a single objective, the target ob- jective. Despite substantial literature on crowd simulations, many of these previous studies have focused on pedestrian modeling in urban spaces, mainly emphasizing on the synthesis of natural locomotion and path planning following the agent-based ap- proach. The same approach has been extensively implemented in most video games to drive multiple types of characters on screen as well.

2 The standard agent-based approach to behavioral systems specifies the factors

underlying synthesized crowd behaviors. For instance, in the flocking model, three

steering behaviors are observed: separation, cohesion, and alignment. Separation provides the overall motion with a preventive response to crowding. This steering behavior attributes a certain distance between one member and the other. In contrast to separation, cohesion is the capability of one member to approach another member than to separate from it. This motion occurs between the nearest characters. The manipulative element in this behavior is the center of gravity or the ”average position”

[24]. Alignment refers to the way in which the movements of the members of the group correspond to the movements of one another; this implies that one action should complement another action, thereby creating an alignment. These three behaviors enable the occurrence of the flocking behavior. A combination of these behaviors also is the basis of the boids model of flocks. Hence, the above mentioned behaviors correlate with the behaviors of members within the neighborhood, while the behaviors of others are ignored. For more complicated crowd models, the standard agent-based model is usually extended by including additional rules to produce desirable behaviors.

In this thesis, instead of encoding everything as rules, we propose a strategy for allowing a second level of control and hence to avoid rule proliferation and the problems associated with the scale in rule-based systems. Also, our system exhibits decision making that is not selfish but altruistic.

1.1 Problem Statement

Our system aims to model the behaviors in a team-oriented crowd using the global objective of controlling the individual and group behaviors. We intend to model a

3 system in which behavioral decisions are made not only at the individual levels but

also at the global levels in a crowd. The behavioral decisions that our system make

will be what is best for the global objectives of the crowd, not what is best for an

individual. Therefore, we intend to ensure that our simulated behaviors capture as

much human subtlety and situational appropriateness as possible.

The main contribution of this thesis is as follows.

• The use of global objectives to control behaviors in team-oriented crowds: We

want our system to operate by making individual decisions on the fly, where

the decisions are based on its perception as well as the global objectives of its

associated group. By allowing a second level of control that is not strictly rule-

based, we look to generate behaviors that are most appropriate for satisfying

the global objectives. We therefore want to develop an organizational tool

that avoids rule proliferation and problems with scale in rule-based systems.

Figure 1.1 shows a high-level flow of our agent-based behavioral system for

team-oriented crowds.

1.2 Techniques

During simulation, the standard agent-based system conforms to rules that provide each member of the crowd with the capability to execute a behavior; this will help in manifesting a believable group behavior. Our system is an extension of the standard agent-based behavioral system. Such a system was extensively used because the real crowds clearly operate with each individual making independent decisions.

Furthermore, instead of encoding all the decisions as rules, our system also consid- ers global objectives in decision making. These global objectives take precedence over

4 Figure 1.1: Agent-based system that uses global objectives to control behaviors in team-oriented crowds

independent decisions so that a member, during the course of his behavior according to assigned rules, can recognize a situation that will violate the global objectives. We then reason about the above mentioned scenario.

Thus, the core feature of our crowd system is its ability to incorporate the global objectives to control behaviors in team-oriented crowds. Our agent-based system allows each agent to perform behaviors in groups and also permits each agent to make individual decisions within the framework of the global objectives. We utilize a heuristic function, which computes a weighted distance metric, to achieve human- like altruistic behaviors in team-oriented crowds. (the ’distance’ is in a parameter space) Because the heuristic function helps to arrive at a locally optimum choice, it is especially useful for generating natural human behaviors in team-oriented crowds.

By utilizing the weighted distance function, we attempt to characterize a conceptual notion of the behaviors that conform to the global objectives of crowds. In other words, the weighted distance metric is used to ensure the altruistic satisfaction of

5 the global objectives by penalizing the behaviors that violate these global objectives.

Therefore, we avoid rule proliferation and problems associated with scale in strictly rule-based systems and allow a second level of control that is not strictly rule-based.

This approach reduces the complexity and is conducive to the emulation of human behaviors in team-oriented crowds.

We assess our system by examining the accuracy of the overall individual and group behaviors in various football situations.

1.3 Overview

The remainder of this thesis is organized as follows.

We discuss a review of related work in Chapter 2. In Chapter 3, we discuss the general characteristics of the crowds, which we are attempting to generate. Further, we discuss our techniques for synthesizing altruistic behaviors: general agent-based system, heuristic function, and distance metric. In Chapter 4, we briefly review the initial setup for the kickoff simulation and some basic behaviors in a football kickoff scenario. Chapter 5, we discuss how our system is utilized for the football kickoff scenario, especially in the path planning and blocking assignments. In Chapter 6, we discuss the results of our crowd system. Finally, in Chapter 7, we conclude the thesis with a discussion on future work.

6 CHAPTER 2

BACKGROUND

Reproducing crowd behavior in a realistic and controllable manner has long been a goal of researchers, film makers, and game developers. The crowd system presented in this thesis was inspired by numerous research studies on agent-based methods for animating crowd behaviors. This chapter focuses on the related works of other re- searchers, with special emphasis on the agent-based method and behavioral modeling for autonomous characters. We consider agent-based methods and how they evolved from simple key framing to self-animating characters that react appropriately to the perceived environments.

2.1 Crowd Modeling and Animation

Agent-based approaches and behavioral modeling are often used to simulate hu- man crowds. This is the most natural way to model the locomotion of large human crowds, in which each person plans individually [21]. This is mainly because people have distinct characteristics and make decisions based on personal goals [21]. Behav- ioral modeling is a major trend in the motion picture special effects industry [34].

It has also been popular for controlling multiple animated characters in interactive games and multimedia applications [34].

7 2.1.1 Behavioral Modeling

Craig Reynolds is one of the pioneers of behavioral models on animation. One

of his works consisted of defining a structural model of the flocking method. He

explained that the flight of a flock of birds is the result of smooth and controlled

actions. The use of a behavioral model in animation was first demonstrated in the

groundbreaking short film ”Stanley and Stella”; since then, it has been extensively

used in the motion picture industry. An animated flock of bats in ”Batman Returns”,

herds of wildebeests in ”The Lion King,” and crowd scenes in ”Mulan” were all created

using Reynolds’ techniques [34]. After his pioneering work, Reynolds expanded the

set of possible behaviors [24], and his method has become a major trend in the motion

picture special effects industry as well as in the game industry. A recently released

game console, PlayStation 3, utilizes Reynolds’ method extensively with a particle

system [25].

2.1.2 Agent-based Approach

The artificial life model developed by Tu et al [35] demonstrates the concept of au- tonomous agents; in this model, an artificial fish is an autonomous agent with motor, perceptional, behavioral, and learning systems. This concept was further developed by Funges et al [8] by introducing cognitive modeling to artificial life models. They addressed the problems of directing autonomous characters to perform specific tasks and developed intelligent characters that can reason and plan their actions. These cognitive models go beyond behavioral models, that is, they govern what a character knows, how that knowledge is acquired, and how it can be used to plan actions [8].

Figure 2.1 shows the computer graphics modeling hierarchy, with cognitive modeling

8 Year Title Studio 1987 Stanley and Stella in: Breaking Symbolics the Ice (short) 1988 Behave (short) R. Allen 1989 The Little Death (short) Symbolics 1992 Batman Returns Warner Brothers 1993 Cliffhanger Carolco Pictures 1994 The Lion King Walt Disney Productions 1996 From Dusk Till Dawn 1996 The Hunchback of Notre Dame Walt Disney Productions 1997 Hercules Walt Disney Productions 1997 Spawn 1997 Starship Troopers Tristar Pictures 1998 Mulan Walt Disney Productions 1998 Antz Dreamworks SKG/PDI 1998 A Bug’s Life Walt Disney Productions/Pixar 1998 The Prince of Egypt Dreamworks SKG 1999 Star Wars: Episode I - The Lucasfilm Phantom Menace 2001 The Lord of the Rings: The New Line Cinema Return of the King 2002 The Lord of the Rings: The New Line Cinema Two Towers 2003 The Lord of the Rings: The New Line Cinema Fellowship of the Ring 2004 Troy Warner Brothers 2004 I, Robot Twentieth Century Fox 2005 Madagascar Dreamworks SKG/PDI 2005 King Kong 2006 The Ant Bully Warner Brothers 2007 I AM LEGEND Sony Imageworks 2007 PlayStation 3 Sony Computer Entertainment

Table 2.1: Examples of behavioral animation in movies and games

9 at the apex of the pyramid [8]. Shao et al [27] expanded their artificial life approach even further and adapts it to the case of an autonomous virtual human model that can populate large-scale urban spaces. The techniques integrate motor, perceptual, behavioral, and cognitive components within a model of pedestrians as individuals

[27]. The bulk of the research that followed has focused on synthesizing natural locomotion and path planning [27].

Figure 2.1: Computer graphics cognitive modeling hierarchy as proposed by Funge et al.

2.1.3 Crowd Simulation in Movies and Games

The simulation of a crowd in a specific environment is a challenging task. The dif-

ficulties lie in the rich behavior, computational cost, and control of agents. However, huge battle scenes, as in the movie ”300,” have become common set pieces in films and games. A crowd simulation software called ”Massive” has been used to create many of these scenes. Massive uses fuzzy logic to control crowd simulations. Fuzzy

10 logic views the world with grey values, instead of black and white values. Behaviors are described in terms of motivations from the point of view of each individual. In order to produce a crowd with diverse behaviors, fuzzy logic, supported by a finite state machine, is created. The finite state machine can be very easily proliferated with increasing number of behaviors required for the crowd. Figure 2.2 shows the

finite state machines in Massive.

Figure 2.2: As the required behaviors increase, ”Brain” in Massive software can rapidly become very complicated and unmanageable.

Numerous crowds are commonly displayed in many of today’s games. Several

first-person shooting games like ”Battlefield,” which involves team assault, battle, and rescue, appear to have more realistic behaviors. Small groups of multiple char- acters are able to communicate and behave according to their intended purpose. For instance, when the units move from one location to the other, in addition to the general group, there are groups surveying each direction for possible ambush. Be- side Massive software, another crowd system that is often used in today’s games is

SpirOps’ crowd system. The system was used as a crowd tool and A.I. middleware in ”Splinter Cell - Double Agent” game [2]. SpirOps’ crowd system is also supported

11 by the finite state machine which SpirOps called ”condition based A.I.”. Hence, as in Massive, rules to control agents in the system can proliferate very quickly. Figure

2.3 shows an example of condition based A.I. and Figure 2.4 shows a screen capture of SpirOps’ system.

Figure 2.3: Condition based A.I.

As mentioned above, various systems have been developed to improve the game

AI of the first-person shooting games as well as strategy games like ”World of War- craft”. Generally, most approaches extend the standard agent-based approach. The architectural approach is one of the most effective approaches for allowing complex group behaviors [9]. This approach simplifies decision-making by utilizing the hier- archies of different behavioral levels, and it is conducive to the emulation of human decision-making [9].

2.1.4 Sports Simulation

Even though crowd simulations have been studied extensively and many sports games have been released to date, there are very few references to how the behaviors of individuals and groups in sports are modeled. Thalmann et al. showed a tennis game simulation with synthetic actors as players and a referee using synthetic vision and audition. The system focuses on the advancement of sensor-based behavior modeling

12 Figure 2.4: SpirOps crowd system was used as a crowd tool and A.I. middleware in ”Splinter Cell - Double Agent” game

by utilizing vision, audition, and the sense of touch in the perceptive world of virtual reality [18]. However, references to how players are controlled in the team-oriented sports games such as Madden NFL were unavailable.

The above agent-based and behavioral modeling techniques are effective in many situations; however, with an increase in demand for more complex and realistic be- haviors, the problems of scale for rule-based systems can quickly become an issue.

By adding another set of rules that incorporate the desired behaviors, the rule-based methods can become difficult to manage, as shown in Figure 2.2. We therefore con- sider developing an organizational tool that avoids rule proliferation and problems with the scale in strictly rule-based systems.

13 2.1.5 Pathfinding Algorithms

Various pathfinding algorithms have been researched extensively for cases in which one or more characters are moving through a field of obstacles toward a goal. A*, one of the best-first search algorithms, is the most popular choice for pathfinding, because it is fairly flexible and it can be used in a wide range of contexts [26]. This algorithm searches a state space (e.g., visibility graph, grid cells) using distance transform or heuristics to find the lowest cost path from the characters’ start state to the goal state [31]. However, A* assumes that the environment is completely known before a character begins its move [31].

In order to optimize the efficiency of the A* pathfinding algorithm, many varia- tions of the algorithm have been devised: beam search, iterative deepening, dynamic weighting, bandwidth search, D*, Lifelong Planning A* (LPA*), and bidirectional search. Among these variations, D* and LPA* are the most noteworthy since they are designed to work in dynamic environments. D* allows changes to be made to the world after the initial path is computed [31]. If the world is a dynamically changing environment, A* can make mistakes [20]. LPA* is intended for use when the costs are changing. With A*, the path may be invalidated by changes to the map; LPA* can reuse the previous A* computations to produce a new path [20].

Depth-first search and breadth-first search are two special cases of the A* algo- rithm. Dijkstra’s algorithm, as another example of a best-first search algorithm, is the special case of A* where the heuristic estimate is 0 for all nodes in the path [26].

We utilize a pathfinding algorithm to help in allowing the second level of control during the simulation. The details of our approach for utilizing the pathfinding algorithm are discussed in Chapter 5.

14 CHAPTER 3

USING GLOBAL OBJECTIVES TO CONTROL BEHAVIORS IN CROWDS

Modeling behaviors in team-oriented crowds is a difficult task not only because of the complexity of individual and group behaviors but also because these behaviors need to ensure altruistic satisfaction of the global objectives of the crowds. Our system aims to model the behaviors in team-oriented crowds using global objectives to control individual and group behaviors. Our objective is not the modeling of the behavioral systems that can respond to an individual belief system. Such systems have already been studied to some extent (see Musse [4]). We aim at modeling a system in which behavioral decisions are made not just at the individual levels but also at the global levels in the crowds. The behavioral decisions made by our system will be what is best for the global objectives of the crowds and not what is best for an individual.

This chapter focuses on how our system extends the existing agent-based method to generate crowd behaviors for team-oriented crowds. We first discuss the use of an agent-based approach for the team-oriented crowds. We then explain the general characteristics of the crowd that our system attempts to generate. Finally, we describe

15 the basic structure of our system and introduce the heuristic function and distance metric that are used to determine the individual and group behaviors for each agent.

3.1 Agent-based Approach for Team-oriented Crowds

The systems that synthesize crowd motions often suffer from a conflict between the need to reproduce homogeneous crowd behaviors such as flocking and the need to allow multiple characters within the crowd to display some structure to the group in which behaviors of those multiple characters are different from the rest of the crowds.

In order to obtain realistic results, especially when team-oriented crowds are involved, it is necessary to consider how the characters will adapt their behaviors in response to the global objectives of their assigned team and the dynamic environments around them. In other words, not only do the characters have their own set of local objectives but there are also some global objectives that they must conform to.

A ”group” in this thesis implies the characters with shared behaviors and are close in space. The term ”team” in team-oriented crowds indicates multiple groups.

Agent-Based Approach

The agent-based approach, as in flocking, is the most popular method for syn- thesizing crowd motion. The approach is often used to simulate human crowds in movies and games. However, the standard agent-based approach is often not suitable for handling the behaviors that emerge in team-oriented crowds. The agent-based approach used for pedestrian modeling and for driving characters in games is capable of self-control and self-animate. This approach can capture each person’s unique situ- ation: visibility, the proximity of other agents, and other local factors [21]. However,

16 for team-oriented crowds, it is essential to consider how the individuals will adapt their behaviors to the global objectives of the crowd. In order to obtain realistic results, it is essential that these behaviors conform to the global objectives of the crowd.

For example, synthesizing believable behaviors in team sports often involve a group of players carrying out similar assignments based on the objectives of their team. Each player has to make independent decisions based on various situations; however, the decisions must conform to the global objectives of the team. The behavioral decisions provide a means of infusing life into the crowd simulation by positioning each agent at a believable location that is assessed by the global objectives. Thus, instead of using the standard agent-based approach, several modified approaches for designing systems for team-oriented crowds have been proposed. One of the approaches is the architectural approach that uses hierarchies to simplify the decision-making at different levels within a team structure [9].

These modified approaches can adapt behaviors to the group objectives using either the summation of attraction/repulsion vectors and/or by triggering different states based on circumstances and parameters. However, these vectors and states of- ten encode behaviors that are limited to only groups of characters without considering altruistic satisfaction of the global objectives.

Our system also extends the agent-based approach to generate team-oriented crowds. However, instead of encoding everything as rules, our system tries to in- duce behaviors that conform to the global objectives of the crowds. Therefore, our system attempts to make behavior decisions that are not selfish but altruistic in order to increase realism and complexity. The individual decision that our system makes

17 will be what is best for the group and crowd and not what is best for each individual.

Further, the rules that decide the behaviors will be weighted appropriately to yield more realistic results.

Therefore, we would like to improve the existing agent-based approach by incorpo- rating the global objectives to make appropriate behavioral decisions for each agent. If the global objectives are well defined, our system will create behaviors that mimic how each person would behave in different scenarios involving the team-oriented crowds.

In the next section, we describe the key characteristics of team-oriented crowds.

Then, we describe the basic structure and the mechanism of our system.

3.2 Team-oriented Crowds

Most crowds are not homogeneous, i.e., when we look at crowds, we can easily spot some groups consisting of multiple characters whose behaviors are different from that of the rest of the crowds. These groups can emerge without explicitly defining them ahead of time. For example, the people in the immediate vicinity of an explosion will

flee from the area and will thus constitute the ”fleeing” group; on the other hand, the people around the corner who have not experienced the explosion first hand will exhibit a ” what was that sound?” behavior. Thus, people can perceive emergency events and change their consequent behaviors and their individualities to form groups

[4].

Groups containing multiple characters are also spotted in team-oriented activities.

However, in most team-oriented crowds, each individual has its group membership predefined. Each group then has its own set of global objectives that the group must execute. For instance, the armed forces, which probably are the most structured

18 crowds in the world, have a strongly predefined group membership in the form of top- down hierarchies. Fire teams are usually almost at the bottom; they are the smallest groups of modern armed forces consisting of a team leader, an automatic rifleman, a grenadier, and a rifleman or assistant automatic rifleman [12]. Further, most sports activities employ the predefined group structures with specific formulations such as the ”3-5-2” scheme in soccer or a shotgun formulation in football. The predefined group memberships strongly influence each individual to stay within specified group structures. Further, with each membership, various global objectives accompany each individual. Hence, when an individual performs some actions, those actions must conform to the global objectives of his team.

In this thesis, we focus on synthesizing crowd behaviors in team-oriented activities.

The behaviors that our system attempts to produce will be what is best for the global objectives of the crowds and not what is best for an individual. In the following sections, we describe the structures of our system and the mechanism of the generation of these crowd behaviors.

3.3 Structure of Crowd System

When considering how to simulate team-oriented crowds, it is important to under- stand the necessity for behaviors that conform to the global objectives of the crowds.

Our system allows individual behaviors as well as group behaviors to be performed by each agent. Each agent tries to execute the global objectives by making individual and group behavioral decisions. Figure 3.1 shows the high-level flow of our crowd system. Most of the characteristics of each agent in our system are initialized when we assign attributes during the pre-process phase. In addition, the global objectives

19 Figure 3.1: Crowd simulation using an agent-based system that integrates perceptual and behavioral components for individual and group behaviors. The arrow between the pre-process and real-time process indicates that all the information assigned in the pre-process phase is conveyed to the actual simulation in which the dynamic behaviors are computed for each agent.

and the initial group behaviors are assigned to each agent according to the group membership of the agent. Besides behaviors that are assigned during the pre-process stage, some individual behaviors are also created for a dynamically changing environ- ment during the runtime of the simulation. The upper half of figure 3.1 shows the pre-process phase. The arrow from the pre-process to the real-time process indicates that all the information assigned in the pre-process phase is conveyed to the actual simulation in which dynamic behaviors are computed for each agent. The dynamic behaviors are generated by allowing each agent to reason about its situation.

20 After completing the pre-processing phase, our system positions each agent at a proper location depending on various scenarios. Then, based on the assigned be- haviors and dynamic characteristics of the agents, each agent transitions from one behavior to another seamlessly throughout the animation, generating realistic indi- vidual motions. The global objective plays the role of orchestrating the agents in the simulation by guiding portions of the crowds to form small groups or by positioning them in a believable location that is assessed by the global objectives. The dynamic behaviors are also generated during the runtime phase using a heuristic function with a weighted distance metric. In other words, individuals in the crowds are assigned global objectives based on their roles in their group and in the crowd. The following section describes the mechanism behind the generation of behaviors that conform to the global objectives of the crowd.

3.4 Behavior Generation

In this section, we develop a mechanism for our behavior generation. We begin with a set of observations about individual and group behaviors that emerge in team- oriented activities, with each observation culminating in a particular property. Our behavior generation model is directly constructed from these properties. Figure 3.2 shows the high-level description of the system in terms of its properties.

Each person in a team-oriented crowd or even in a general crowd, has distinct characteristics and makes decisions based on personal goals. People are able to self- control, self-animate, and self-evolve. Furthermore, people react to collisions and contacts with other people.

21 Figure 3.2: A high-level description of the system in terms of its properties. Au- tonomous agents with current states, s1...n, are used in the simulation. After the current environment is registered with each agent, different behaviors are assigned based on a heuristic function computed by a distance metric. Following this, the states are updated based on the behavior assignments.

Property 1. Agent Model: Each agent is autonomous and represented by a

physical model.

An agent is represented by a rigid body with physical attributes that are gener-

ally possessed by people; however, these attributes vary for different scenarios

and assignments. The interaction forces between two agents are simplified by

not considering friction, but instead, by using the repulsive forces. The change

in velocity between frames is represented by the following acceleration equation:

dv m i + F = F + F (3.1) i dt radial i radial

where,

- mi is the mass of the ith agent - vi is the velocity of the ith agent - Fi is the force on the ith agent - Fradial is the repulsion force among agents using a radial field in Maya

22 The desired orientation of each agent is given as follows:

θy = arctan(vx, vz) (3.2)

where vx and vz represent the velocity in the x and z directions, respectively.

When considering small groups that form within the team-oriented crowds, there is a global objective that each individual in the group must consider before any of the local rules. The global objective can be a scheme in sports such as returning a kickoff through the middle or a tactic in battle scenarios such as defending a bridge to secure a camp. In our system, the global objective is assigned during the pre- process phase of the simulation, and it is conveyed throughout the simulation as one of the state variables. Knowing the global objective at each time step plays a crucial role in generating behaviors that incorporate both local and global objectives in the subsequent properties.

Property 2. State Assignment: Each agent is aware of its state and the global

objective.

At each time step of the simulation, each agent has a state s:

si = {t, ~p, θ, Fi, og, a1...n} (3.3)

where,

- t is the time - ~p is a position vector - θ is the orientation

- Fi is force - og is a global objective - a1...n are the possible actions that can be performed

23 Fi is a force computed from the previous phase. The global objective is included

in s throughout the simulation to affect the decision making of each agent. The

action, a, is directly linked to the individual and group behaviors. The action is

performed once our system determines which behavior should be selected for the

current situation based on the global objective and the perceived environment.

How the actions are selected is described in the following sections.

In order to dynamically adapt to the global objective during the simulation, each agent must be able to perceive the current situation and react to it accordingly. In general, we assume that people can adapt their individual behaviors based on their perception and their knowledge of what the overall strategy is. For example, a kick returner in football will run toward the initially assigned running lane, but he can also alter his path based on his perception as long as the overall strategy of his team is not violated. Multiple units trying to attack their enemies must be able to monitor a given environment and strike the most vulnerable area close to the initial path of attack. The next property models the perception of an agent.

Property 3. Perception: Each agent can perceive only the partial environment,

r et , that is visible to the agent. In our crowd system, each agent’s vision covers an average human’s 140-degree

binocular vision [30]. Thus, agents only have a partial view of the environment.

However, agents can rotate to obtain more environment. For instance, an agent

can look forward, left, and right to explore the surrounding environment. The

r regions perceived during each turn are denoted by r. Therefore, et is a region r of the environment that can be perceived by some agent at time t. Any

object can be seen by the agent if a part of the object lies within the agent’s

24 field of vision. The angle of vision can be randomized or adjusted to meet the

specific application requirements. Figure 3.3 shows the binocular vision and the

different regions of the environment.

Figure 3.3: (a) Average 140-degree binocular vision. (b) Altered vision to simulate the binocular vision of a football player whose vision is impeded by a helmet. The red rectangles are objects that are ”seen”, and the light blue rectangles are objects that are not. (c) An agent can rotate to perceive its environment, and r denotes each region that the agent can see.

Based on the different regions in the environment that are perceived by agents,

the agents can query the object database to identify the nearby objects. More-

over, each agent is able to query the state variables to obtain information such

as the instantaneous velocities of the objects of interest, as in the case of Tu’s

work [35]. Table 3.1 lists the possible state variables that can be retrieved. All

the state variables obtained by the agent are used to decide the behaviors in

the following phase.

We now combine the above properties by creating an agent that is autonomous and knowledgable of its states and who can perceive its environment. We describe the mechanism behind how our system computes the appropriate individual and group

25 Parameter Description

di Distance between the ith agent and the other agents. The distances can be used to decide which agent is clos- est or farthest from the ith agent. li A list of agents that are visible to the ith agent ~pi Position of the ith agent vi Velocity of the ith agent αi Current status of the ith agent. If the agent is engaged in some activity, it returns the status as busy or a type of activity. βi Assigned group of the ith agent. A group that the agent belongs to can change during the simulation, and βi helps to identify which group the agent belongs to. og Global objective of the crowd

r Table 3.1: Possible state variables for the current perceivable environment et . These variables can be retrieved by the agents to decide about their behaviors. These variables are used in computing the distance metric.

behaviors that conform to the global objectives of team-oriented crowds. In general, people choose their individual behavior based on their personal goals. However, this preference is hindered by an obligation to adhere to the global objectives assigned to a group. For example, troops in battle scenarios will usually engage in a combat if there is an enemy en route to their goal. However, if the global objective is to stealthily intrude into the enemy’s headquarters, the troops might change their route depending on whether or not there is an enemy nearby before they reach their final destination. Hence, by abandoning the initial local behaviors and by adopting a different behavior, the troops attempt to satisfy the global objectives. In order to simulate team-oriented crowd behavior realistically, we require a method to make the global objectives and the local behavior interact with each other. Consequently, a

26 crowd system must have a dynamic adaptation of behaviors based on perception of the environment and knowledge of the global objectives.

Property 4. Behavior Selection: The global objective and local behavior need

to interact to allow the dynamic adaptation of behaviors.

Let us consider a set of possible states s = {s1, s2, . . . , sn}, where si is a partic-

r ular state, and et is the current partial environment that is perceivable by the agent with r number of different regions. A heuristic function, h, evaluates a

r state, si, in all possible regions, et , at time t. Then, based on the evaluation, the heuristic function decides the optimal action to be taken in the current sit-

uation.

A prototype heuristic function is shown below:

r Heuristic function h(si, eoptm, et , a1..n, τ) { r for each (r in et ) r x = Evaluate (si on et and eoptm) if (x < τ) break; else r++; continue; return ar }

The function takes in several parameters: the current state of an agent, optimum

environment, different regions in the current perceivable environment, possible

actions, and a threshold. The definition of the optimum environment, eoptm,

varies depending on the scenarios, but it is usually an environment setting that is

most beneficial to reach a certain goal. For instance, the optimum environment

27 for a battle scenario might be when the enemies have no armors left to resist the attack or when the number of enemies is close to zero. The threshold, τ, is used for optimization by not allowing the function to evaluate all possible regions in the current environment. When the value of the evaluating function is above a certain threshold, the heuristic function returns an appropriate action for an agent to execute.

For example, in a general locomotion model, the heuristic function at time t would return four different actions given a threshold, τ, and three different

r regions for an environment, et . The environment could be a street with some obstacles that an agent needs to avoid as it travels from one point to the other.

The regions would be three different partial environments that the agent can perceive by rotating its vision from the left to the center and from the center to the right. The optimum environment, eoptm, would be an empty street and the actions can be left, forward, right, and stop:

 left r = 0 and x < τ for er  t  forward r = 1 and x < τ for er Heuristic(s , e , er, a , τ) = t i optm t 1..n right r = 2 and x < τ for er  t  r stop 2 >= r >= 0 and x > τ for et

The evaluate routine inside a heuristic function computes a distance metric.

The distance metric, which is discussed in the next section, is applied to each region, which is a partial environment that is perceivable by an agent. By uti- lizing a weighted distance function, we try to characterize a conceptual notion of behaviors that conform to the global objectives of crowds. In other words,

28 the weighted distance metric is used in an attempt to ensure altruistic satisfac- tion of the global objectives by penalizing the behaviors that violate the global objectives. Therefore, the behavior that is most appropriate for satisfying the global objectives is determined. An action is selected for the region in the envi- ronment when a sufficiently low score is obtained by using the proposed distance metric.

Distance Metric

Our distance metric is modeled most closely after the one introduced by Ko-

r var et al. [13]. The distance metric, D(eoptm, et , og), is computed between the optimum environment, eoptm, and the different regions in the perceived environ-

r ments, et . The state variables and the global objectives at time t during the simulation are used in computing the distance metric. The purpose of including the global objectives is to ensure that the local behaviors that violate the global objectives are penalized in the calculated metric in order to generate behaviors that conform to the global objectives of the crowd. The metric is computed as a weighted sum of the square of the difference between the state variables of the optimum environment and the state variables of the perceived environment.

The equation used to compute the metric is as follows:

n m r X X r 2 D(eoptm, et , og) = wjkeoptm(j) − et (i, j)k (3.4) i=0 j=0 where,

- eoptm is the optimum environment r - et is the perceived region r of the environment - og is the global objective of the crowd

29 - n is the number of agents in the region - m is the number of state variables

- wj is the importance weight of the state variables r - et (i, j) is the jth simulation parameter value of the ith agent in region r

The distance metric is computed for every region of the perceived environment

at time t, as shown in Figure 3.4. We would like the distance metric to ex-

r Figure 3.4: The distance metric, D(eoptm, et , og), is computed between the optimum r environment, eoptm, and the perceived environments, et , during the simulation using the state variables and the global objectives at time t. The heuristic function examines the distances to determine the subsequent behaviors for an agent using a threshold, τ. The grey area represents the environments at a certain time (t) during the simulations.

tract the perceptually acceptable behaviors; however, the optimal importance

weights used for wj are not known and they vary considerably depending on

the applications.

30 For example, Table 3.2 contains our empirically tuned weights for the kickoff

scenario. We selected and assigned a set of weights that favor the reasoning

of players and found them to work well for various situations in the kickoff

simulation. Once the distance metric is computed, the heuristic function can

decide the region to execute the subsequent behavior that is not what is best

for each agent but what is best for the group and the crowd.

While the time and space requirements for computing the distance metric in

our problem were quite modest, our state variables were limited to a few differ-

ent kinds of variables. We believe that our experiments are sufficient to show

the potential of our method; a scenario with a truly diverse set of state vari-

ables with a larger crowd will require a considerably greater computation time.

However, computing the distance metric can be parallelized to speed up the

calculation. Further, the distance metric can be optimized even more by ex-

cluding the agents that are irrelevant at the time of computation by regulating

the viewing depth of the agents.

Parameter Weight Optimum

di 0.2 1.0 lt 0.5 0.0 ~pi 0.4 1.0 vi 0.1 0.0 αi 0.3 0.0 βi 0.1 1.0 og 0.8 1.0

Table 3.2: Weights used by our distance metric to give more importance to different state variables. The weights can be altered depending on the applications.

31 For the actions that are performed by each agent, an arbitration mechanism is re- quired to determine the appropriate behavior at any point in time. After the initial behaviors and attributes are determined, each agent starts to execute those behaviors based on the current environment. As the environment evolves, the agent has the ability to perceive and examine the environment by using the heuristic function and the distance metric to determine the actions that are more favorable to the global responsibilities. Thus, during our simulation, actions are produced based on percep- tions and tactical responsibilities while trying to decide the behaviors that are within the global objective.

Applying our system to practical problems, we found the football kickoff scenario to be a convenient problem domain for testing a more general theory of modeling the behaviors of group members and for testing how members make individual decisions within the structure of the global objectives. Chapters 4 and 5 describe how our system is used for the football kickoff scenario.

32 CHAPTER 4

SETTING UP A SYSTEM FOR FOOTBALL KICKOFF SIMULATION

The kickoff scenario in football is a convenient problem domain for testing our the- ory. First, football is a strongly team-oriented sport. Secondly, multilevel behaviors are exhibited during football kickoff: individual, group, and global. Most importantly, we can easily spot the behaviors where the behavioral decisions are made according to what is best for the global objectives of the team and not what is best for an individual player.

This chapter describes how our system is set up to simulate kickoff. We first ex- plain the initial process of assigning different attributes, behaviors, and group mem- berships. We also explain how the particle system and dynamics in Maya are utilized in our system. We then describe the basic behaviors involved in kickoff including the blocking behaviors. How the global objectives influence the behavioral decisions will be discussed in Chapter 5.

4.1 Initial Phase of the Simulation

During the initial phase of the kickoff simulation, the players are divided into two teams: defense and offense. Once the global schemes for both offense and defense

33 Figure 4.1: During the initial phase of the crowd simulation, individual and group behaviors are assigned along with various attributes.

are determined, each player is then assigned various attributes, behaviors, and group memberships based on the schemes. As in the case of a real football game, our system tries to put together various groups with the right players for different tactics.

For example, the players in a wedge group have physical attributes that are suitable for blocking, for example, heavy and strong. In contrast, a kick returner is assigned attributes such as fast, quick, and good vision. Among the defenders, three are wedge breakers who are bulky and strong. The remaining defenders are fast and quick. The defenders work to avoid the blockers once they are engaged in blocks. The blockers try to engage in blocks, instead of avoiding them.

Table 4.1 lists all the available behaviors and attributes.

Initial Setup Attributes and Behaviors Physical Attributes Mass (Weight), Speed/Acceleration, Strength, Width, Height Group Behaviors Defense, Offense, Wedge Group, Wedge Breaker, Blocker Individual Behaviors Block, Tackle, Avoid, Pursuit, Return

Table 4.1: Varying attributes make the simulation more realistic

34 4.2 Model

A football player in our simulated scene is represented by a cube - a Maya polygo- nal primitive. Each cube is an active rigid body that is able to react to collisions and contacts. The cube has a radial field connected to its center to emulate the repulsive forces between two players. A Maya particle was then placed at the center of each cube to be instanced with a model with a motion capture animation clip. A higher resolution model can replace a low resolution model to achieve more realistic anima- tions. Since only the primitive cube represents the player model, the simulation is very efficient and runs in realtime. Figure 4.2 shows the basic structure of the model that was used in our kickoff simulation.

Figure 4.2: (a) Setup in Maya where a particle is instanced by a primitive box; (b) A low-resolution model; and (c) a high-resolution model

35 4.3 Field Setup

Once the initial setup of assigning attributes, behaviors, and group memberships is completed, each player needs to be placed in its appropriate position. Our system places ten defenders, five wedge blockers, five blockers, and a kick returner in the football field. Figure 4.3 illustrates the initial setup for the kickoff when the global scheme for both offense and defense is to ”return/cover middle.” Among the defenders, three wedge breakers are positioned in the middle so that they have the shortest path to the wedge. The remaining defenders are placed evenly on both sides of the wedge breakers. The wedge group players form a line behind the other blockers and in front of the kick returner.

4.4 Basic Behaviors

It is essential to induce appropriate behaviors for each player according to the global objectives in order to generate a realistic simulation. The behaviors must ensure that each player’s position and subsequent behaviors result in a natural and realistic motion. For instance, when the football is kicked off, five players in the wedge group must set up a wedge in front of the assigned direction of the kick returner. The players in the wedge group are able to form a wedge since the initial group behaviors were assigned during the pre-process stage. The wedge breakers among the defenders are then required to run into the wedge, thereby disrupting the initial play. The initial group behaviors also allow the wedge breakers to try to break the wedge. The blockers must try to open up a running lane for the kick returner. Then, the defenders need to try to avoid the blockers and pursue the kick returner. The kick returner

36 Figure 4.3: Initial setup for the kickoff in football. 10 defenders, Wedge group of 5 players, 5 blockers, and a kick returner

must be directed to run through the assigned running lane that the blockers should have created.

The basic behaviors in our kickoff simulation are described as follows:

• When the football is in the air

The kick returner moves to the landing location of the football. Five players in

the wedge group form a wedge and five blockers remain in front of the wedge.

All defenders run straight until the kick returner commits to one side of the

field. Each defender has to stay within his assigned lane to cover the entire

field. The landing location of the football is calculated from equations (4.1)

37 and (4.2) given below :

The total time that the ball travels is given as

ttotal = (2 ∗ vinit ∗ sin(θ))/g (4.1)

The total distance the ball travels is given as

dtotal = vinit ∗ ttotal ∗ cos(θ) (4.2)

where,

- dtotal is the total distance - ttotal is the total time - vinit is the initial velocity - θ is the angle of the kick - g is the gravity

• When the football is caught by the returner

The five blockers remain in front of the wedge group. When the wedge group

players complete a wedge, the blockers start to run towards the defenders. The

kick returner brings the ball up in the direction of the assigned running lane.

The defenders who are the wedge breakers run straight towards the wedge trying

to disrupt or break the wedge. The remaining defenders start to change their

paths to converge on the kick returner. The defenders in the outside lanes

need to be careful not to commit to the returner too early, because they are

responsible for containing the returner inside their lanes.

• During a return

The defenders collide with the wedge group and the blockers. The defenders

persistently try to shake off the blockers and pursue the kick returner. The

38 blockers try to stay in front of the defenders and create a running lane for the

kick returner. When some blockers lose their initial defenders, those blockers

continuously search for other defenders to block. Double-teaming a defender

is allowed while blocking to impart more flexibility to the blocking scheme.

The kick returner, utilizing his perception, tries to find and run through the

running lane created by the blockers. The kick returner constantly looks for

more desirable paths within the global scheme throughout the returning process.

4.5 Basic Blocking Routines

The most prominent behaviors in kickoff are the blocking behaviors between two opposite players. The blockers persistently try to engage with the opposition and consequently to create a running lane for the kick returner. The defenders constantly attempt to disengage from the blocking and subsequently to maintain their pursuit of the kick returner. Figure 4.4 illustrates a basic blocking routine.

Figure 4.4: (a) Illustration of a player calculating a direction based on the acceleration vector of the opposition. (b) Application of impulses at the initial contact. (c) Generation of impulses so that the player can stay in front of its opponent.

39 After a blocker commits to blocking one of the defenders, it calculates a direc- tion based on the acceleration vector of the defender. As in real football, a player anticipates its opposition’s speed to position itself, so that the player can engage in blocking by staying in front of the defender.

Once the blocker and the defender collide, the blocker tries to stay in front of the defender by applying appropriate impulses according to its opposition’s move- ments. The defenders generate impulses not only to circumvent the opposition but also to pursue the kick returner. The ”contactCount” and ”contactName” attributes in rigidBody were used to keep track of collisions.

If the defender passes a point where the blocker and the defender are side-by-side, the blocker releases the defender since there is no way a blocker can stay in front of a defender once the blocker has turned sideways.

Even though the blocking appears as an individual behavior, it is important to understand that the blocking needs to conform to the global objectives. Football is a team-oriented sport. Thus, the blocking decisions are made not just at the individual levels but also at the global levels. Having the initial phase helps to ensure that the individual behaviors are in accordance with the global objectives by assigning attributes, behaviors, and group memberships. Chapter 5 focuses on more eminent behaviors that are influenced by global objectives such as the kick returner’s behaviors and the blocker’s decision regarding whom to block.

40 CHAPTER 5

MODIFYING INDIVIDUAL BEHAVIORS BASED ON GLOBAL OBJECTIVES

In this chapter, we first explain the general group behaviors in kickoff. We also explain how each player has individual decisions to make within the structure of the global objectives. Then, we focus on two aspects of football kickoff, that is, blocking assignments and pathfinding, where the individual decisions are often modified based on the global objectives.

5.1 General Group Behaviors

When considering how to simulate kickoff, it is important to understand the need for group behaviors. Group behaviors provide a means of infusing life into the simula- tion by positioning each player at a believable location that is assessed by the global objectives. If the global objectives are well defined, they will generate the behaviors that mimic how each player would behave in a similar situation during kickoff.

For example, when the global objective is to ”return right,” the wedge group arranges itself to the right of the field. During the return, since the group objective for the blocking group is to set up a running lane to the right of the field, each player

41 tries to open up the running lane by shielding his defender to the left. Figure 5.1 illustrates the blockers trying to shield the defenders to the left.

Figure 5.1: (a) Return to right. (b) The blockers and the defenders engage in blocking. (c) The blockers set up a path to the right by shielding the defenders to the left.

Thus, our system defines appropriate behaviors for each individual according to the global objectives. After the global objectives are initially assigned, each player’s behaviors are adjusted to the evolving environment in an effort to maintain the global objectives of its team. Figure 5.2 shows the effects of different global objectives and how each agent adjusts.

5.2 Blocking Assignments and Pathfinding

Both the blocking assignments and the pathfinding behaviors are greatly influ- enced by the global objectives. During the football kickoff simulation, they are often modified by the global objectives.

42 Figure 5.2: The global objectives are initially assigned. (a) There are three paths that can be assigned. (b) If the middle path is assigned, the blockers try to open up a running lane in the middle. (c) If the path is to the right, the blockers set up a path to the right. (d) The path to the left is given.

• Blocking assignments: The initial blocking scheme is designed to guide each

blocker to maintain the blocking assignments. However, the blocking assign-

ments need to adjust in realtime to the changing situation during a return.

Each assignment must conform to the global objectives.

• Pathfinding: When determining a more desirable running lane while ten defend-

ers are trying to tackle and when ten blockers are endeavoring to open holes for

the returner, the task is to ensure that the simulated behavior remains within

the global objectives. Improvisation without any notion of the global objectives

often results in a broken play and violates the team concept in football.

5.3 Blocking Assignments

We employ the Greedy algorithm in the blocking assignments. Because the Greedy algorithm makes the locally optimum choice in each frame with the hope of finding

43 the global optimum [5], it is especially useful for generating natural human behavior during the kickoff simulation.

Once the global objectives have been conveyed to each blocker, the blocker may be in one of two states: assigned or unassigned. These correspond to the block- ing assignments each player commits. Greedy-algorithm-based transitions are made continuously between the two states as the blocker’s environment changes, provid- ing a more dynamic behavior as the simulation evolves. Figure 5.3 illustrates the transitions between the initial and the dynamic blocking assignments.

Figure 5.3: High-level states of the blocking assignments. The solid black arrows indicate the transition event used to move between each state.

5.3.1 Determining Opponents

As the environment evolves, if the initial assignments become ineffective, new as- signments are created. The new assignments are made based on the optimal choices that our system generates. During the simulation, our system keeps track of all the

44 blocking assignments carried out by each blocker in order to avoid duplicate assign- ments. The optimal choice is then calculated for only the defenders that are available for the assignments by using a distance and a velocity vector for each defender. If no assignments can be made, double-teaming is allowed as a last resort. As each assign- ment is being finalized, the blocking assignment information of the current frame is updated for the next frame. Figure 5.4 shows how our system progresses as it updates the assignments.

Figure 5.4: The greedy algorithm is used in the blocking assignments. (a) Initial state where the circles indicate that the blocking assignments have not been made. (b) Two blocking assignments are made wherein each select the closest opponent. (c) The blocking assignments change in realtime as they adapt to the changing environment.

5.4 Pathfinding

Modeling the manner in which people search for their paths under different cir- cumstances is a difficult task not only because the experimental data is limited but also because people vary greatly in their physiques and prior exposure to given sit- uations. Our algorithm aims to model an average football player with 100-degree binocular vision, which accounts for the vision impeded by the helmet worn by the

45 player. This section describes the algorithm that generates the pathfinding behaviors for the kick returner in our system.

5.4.1 Field of View

Humans have an almost 180-degree forward-facing field of view [36]. However, the range of visual abilities is not uniform across the field of view. Binocular vision, in which both eyes are used together and which is important for depth perception, only covers 140 degrees of the field of view in humans; it does not cover the remaining peripheral 40 degrees because the images from each eye do not overlap [30] [36].

Depth perception is the visual ability to perceive the world in three dimensions [6].

Various degrees of binocular vision can be assigned to the agent, depending on the initial attributes; however, for the sake of consistency, we use a 100-degree range throughout our simulations.

Figure 5.5: (a) Average 140-degree binocular vision. (b) Altered vision to simulate the binocular vision of a football player whose vision is impeded by a helmet. The red rectangles are objects that are ”seen,” while the light blue rectangles are objects that are not. (c) A player can rotate to perceive his environment, and r denotes each region that can be seen by the player.

46 5.4.2 Heuristic Function and Distance Metric

After the kick returner obtains possession of the football, it starts the searching

process. For each perceivable region in the environment, the kick returner queries the

object database to identify the blockers and defenders in the vicinity. It also queries

the state variables to obtain information such as the instantaneous velocities of the

defenders. Table 5.1 lists the possible state variables that can be retrieved for the

kickoff simulation. All the state variables obtained by the kick returner are used in

deciding the pathfinding behaviors.

Parameter Description l A list of players that are visible to the kick returner di Distance between the ith player in the list l and the kick returner. The distances can be used to decide which defender is closest or farthest from the kick returner. ~pi Position of the ith player in the list l vi Velocity of the ith player in the list l αi Current status of the ith player in the list l. If the player is engaged in a block, it returns the status ”block.” βi Assigned team of the ith agent in the list l. βi helps to identify whether the player belongs in the defense or offense. og Global objective of the play

r Table 5.1: State variables for the perceivable environment, et . These variables can be retrieved by the kick returner to decide on its behaviors. These variables are used to compute the distance metric.

After retrieving all the necessary state variables from one of the perceivable re-

r gions, the kick returner evaluates its current state, s, in the region, et , using the

47 heuristic function. The kick returner performs the same process in all regions. Sub- sequently, based on the evaluation, our system decides the optimal action to be taken in the current state. The heuristic function allows the kick returner to abandon its initial behavior and adopt a different behavior in an attempt to satisfy the global objectives.

The FindPath algorithm describes a high-level structure of our pathfinding algo- rithm.

Algorithm : FindPath(Candidates) for EachF rame while Candidates P ath ← Candidate.current(); if P ath.isF easible(heuristic) Solution ← Candidate.current; Candidate.next; else Candidate.next; Continue; return (Solution)

Thus, once the kick returner is given the initial running path, it starts to run to- ward the assigned direction and begins the searching process. Then, each perceivable region is examined by the heuristic function to determine which region is the optimal one for the current frame.

Heuristic Function

The heuristic function makes decisions by computing a distance metric. The weighted distance metric is used in an attempt to ensure the altruistic satisfaction of

48 the global objectives. The behaviors that violate the global objectives are penalized in the calculated metric; thus, the heuristic function generates behaviors that conform to the overall objectives of the team. The equation used to compute the metric is as follows: n m r X X r 2 D(eoptm, et , og) = wjkeoptm(j) − et (i, j)k (5.1) i=0 j=0 where,

- eoptm is the optimum environment r - et is the perceived environment region r - og is the global objective of the team - n is the number of players in the region - m is the number of state variables

- wj is the importance weight of the state variables r - et (i, j) is a jth simulation parameter value of the ith agent in region r

The distance metric is computed for every region of the perceived environment at time t, as shown in Figure 5.6.

In addition, our system further divides the selected region into three new subre- gions and executes the same algorithm to obtain the localized optimal path. There is no upper limit for the level of the partitions; however, for our problem domain, we observed that three levels of partitions are sufficient for finding the optimal path.

Figure 5.7 illustrates the three levels of partitions of the initial environment.

Thus, if there are too many defenders in one of the subregions, the kick returner must avoid the subregion and select an alternate subregion. Figure 5.8 shows the kick returner making one decision and then improvising to select an alternate subregion during the simulation. The yellow regions indicate the current viewing subregion being analyzed by the heuristic function. The grey regions are the subregions that have already been analyzed by the heuristic function.

49 r Figure 5.6: The distance metric, D(eoptm, et , og), between the optimum environment, r eoptm, and the perceived environments, et , is computed during the simulation using the state variables and the global objectives at time t. The heuristic function examines the distances to determine the subsequent behaviors for the kick returner using a threshold, τ . The grey area represents the environments at a certain time (t) during the simulation.

50 Figure 5.7: Our system partitions the initial environment into regions. Once the heuristic function determines that one of the regions has the optimal path, the region is then divided into three new subregions. Our system allows up to three levels of partitions.

Figure 5.8: (a) Initial state where the yellow region represents the vision of the kick returner. (b) A running lane through the middle is chosen. (c) Since the middle region is occupied by both the defenders and blockers, so the right running lane is chosen. (d) Both the middle and right lanes are closed, but there is a running lane to the left of the kick returner.

51 CHAPTER 6

ASSESSMENT

In this chapter, we present the capabilities of our system. We conducted several experiments under different initial conditions to assess the robustness of the system.

We applied three different initial schemes to examine the performance and adaptive nature of the agents with a particular emphasis on the group behaviors, blocking assignments, and pathfinding behaviors. Thus, given the initial conditions of return left, right, and middle in the kickoff scenario, we assess how each player behaves and adapts to the global objectives while creating altruistic behaviors in the process.

Once the global objective is decided, our system allows the formation of appropri- ate groups and directs the kick returner to find a path that will not violate the global objective of its team. Without any knowledge of the current situation concerning the global objective, the kick returner would easily choose the path that is the locally optimal path for itself. However, with our second level of control, which is not strictly rule-based, our system can recognize a situation that will violate the global objectives and create a behavior that takes precedence over the local behavior.

We evaluate the results by examining various situations during kickoff. We provide what would constitute the local behavior when the global objective is not considered.

52 Then, we assess our results based on how the behavior created by our system adapts to the global objective.

This assessment shows that the system is capable of producing altruistic behaviors in team-oriented activities.

6.1 Agent-based Behavioral System

The basic setups in Maya are shown in Figure 6.1. A graphical user interface was designed and developed to provide users with a higher level of control when setting up the crowds. The simulation and rendering were performed at approximately 20 frames per second on a 2.16 GHz Intel Core 2 Duo processor.

Figure 6.1: Left: An initial window that is created when the crowd system is first executed. Center: GUI to control different attributes and variables for the simulation. Right: A render of the simulation using high-resolution models.

53 6.2 Blocking Assignments and Pathfinding

Both the blocking assignments and the pathfinding behaviors are greatly influ- enced by the global objectives. During the football kickoff simulation, they are often modified by the global objectives. Figure 6.2 illustrates these two behaviors.

Figure 6.2: Left: Blocking assignments in our football kickoff simulation. Right: Pathfinding algorithm for the kick returner.

The blocking is first assigned based on how close each defender is to the blockers.

If the closest defender is already blocked by a blocker, the blocker tries to find another defender to block. If none of the defenders are free, double-teaming is allowed. When the blocker is engaged in a block, it will attempt to stay with its block as long as it can by pushing the defender to either side. However, in our system, the global objective takes precedence over the local rules. If the global objective is to return left, the blocker tries to seal the defenders to its right, thereby creating a running lane to its left. The next section illustrates how different global objectives influence the blocking assignment as well as the pathfinding.

54 6.2.1 Different global objectives

Return Right

When the global objective is to return ”right,” the wedge needs to be set up to the right side of the football field. Each blocker must try to seal its defender to the left, thereby setting up a running lane on the right side of the field. Then, the kick returner must be directed toward the right side of the field during the return. Without considering of the global objective, a behavior will be created by simply examining the current situation. The resulting behavior would be the locally optimum choice.

In this case, the kick returner would choose to run toward the middle if it views a bigger opening of a running lane to its middle. However, our system allows the second level of reasoning using global objectives and creates a behavior that keeps the kick returner running to his right. Figure 6.3 shows the simulation of the kickoff when the global objective is ”return right.” The yellow vision indicates the path that was decided by considering the global objective. The grey vision is the path that would have been the choice of the returner if it was simply decided by examining the current situation.

Return Left

If the global objective is to return ”left,” the entire procedure must be the opposite of the ”return right” procedure. Figure 6.4 shows the progress of the simulation with the ”return left” global objective. As in the case of the ”return right” procedure,

55 Figure 6.3: A kickoff simulation with the ”return right” global objective. The yellow vision indicates the path that was decided by considering the global objective. The grey vision is the path that would have been the choice of the returner if it was simply decided by examining the current situation.

the yellow vision indicates the path that was decided by reasoning about the cur- rent situation and the grey vision indicates the path that was determined by simply examining the current situation.

Return Middle

The ”return middle” global objective forces the wedge to be set up in the middle of the field. The blockers attempt to open up the middle running lane for the kick returner. The kick returner attempts to find the most desirable running lane in the middle of the field; had only the local rules been applied, the kick returner would have been running toward the widest hole. Figure 6.5 illustrates the simulation with the ”return middle” global objective.

Evaluations

56 Figure 6.4: A kickoff simulation with the ”return left” global objective. As in the ”return right”, the yellow vision indicates the path that was decided by reasoning about the current situation and the grey vision implies the path that was determined by simply examining the current situation.

Figure 6.5: A kickoff simulation with the ”return middle” global objective.

Our system successfully generates various kickoff simulations with different user- specified input global objectives. Based on the weighing factors of the global objec- tives, the kick returner can strictly follow the global objective, not follow the global objective at all, or improvise effectively within the boundaries of the global objective.

Increasing the weighing factors on the returns to ”right” and ”left” are more favor- able since there are more spaces to execute the global objectives by each agent. By

57 making decisions that are more favorable to the global objectives, the kick returner is rewarded with finer returns. On the other hand, decreasing the weighing factors of the global objectives is more desirable on the returns to ”middle”. Despite the blockers trying to open up a middle running lane, the defenders can easily converge on the middle of the field. By allowing the kick returner to make decisions that are more local than global to the current situation, the kick returner has more flexibilities to execute the returns.

Our system is an organizational tool that avoids rule proliferation and allows a second level of control by reasoning about the current situation. However, the systems flexibility is limited by the behavior availability for scenarios other than football kickoff. In order to apply our system to different scenarios, a substantial increase in the number of behaviors is inevitable. However, each team-oriented sport is so different in many aspects that it is difficult to cover all scenarios in just one system.

58 CHAPTER 7

CONCLUSION

7.1 Summary

A behavioral crowd system that allows human-like altruistic behaviors in team- oriented activities has been successfully developed by increasing the number of rules in the system. However, instead of encoding everything as rules, this thesis has ex- plored the construction of a system that considers the global objectives which take precedence over the ”local behavior.” Thus, while behaving according to the assigned rules, a member can recognize a situation that will possibly violate the global objec- tives, following which the behavior will be interrupted and a suitable action will be taken. This is really no different from simply adding another set of rules pertaining to the global objectives. However, by utilizing the weighted distance function, we at- tempt to characterize a conceptual notion of the behaviors that conform to the global objectives of crowds. In other words, the weighted distance metric is used to ensure the altruistic satisfaction of the global objectives by penalizing the behaviors that vi- olate these global objectives. Therefore, we avoid rule proliferation and the problems associated with scale in strictly rule-based systems and allow a second level of control that is not strictly rule-based. This approach reduces the complexity of the system

59 and is conducive to the emulation of human behaviors in team-oriented crowds. To the best of our knowledge, this approach makes a novel use of the agent-based crowd system to produce altruistic behaviors in team-oriented activities.

Thus, the core feature of our crowd system is its ability to incorporate the global objectives to control behaviors in team-oriented crowds. Our system allows each agent to perform behaviors in groups and also permits each agent to make individual decisions within the framework of the global objectives. We utilize a heuristic func- tion, which computes a weighted distance metric, to achieve human-like altruistic behaviors in team-oriented crowds. Because the heuristic function helps to make a locally optimum choice, it is especially useful for generating natural human behaviors in team-oriented crowds.

7.2 Future Work

The capabilities of our current system can be extended; this will necessitate further studies. In this section, we discuss how our current implementation can be improved by representing a larger set of group behaviors to cover other group activities.

Extending the crowd simulation system

Our crowd simulation system generates behaviors that conform to the global ob- jectives as in the football kickoff scenario; to produce such behaviors for various scenarios, however, a substantial increase in the number of group behaviors for the system is inevitable. Setting up the wedge and opening up the running lane could be altered so that these behaviors can be used in different situations. However, the introduction of a diverse set of group behaviors would allow our system to be used

60 in several different scenarios. Further, while the time and space requirements for computing the distance metric were quite modest in our practical problem, our sim- ulation parameters were limited to a few different kinds of parameters. While we believe our experiments are sufficient to show the potential of our method, a scenario with a truly diverse set of simulation parameters with a larger crowd will require a considerably greater computation time. The computation of the distance metric can be parallelized to speed up the calculation. The system can be further optimized by excluding agents that are irrelevant at the time of computation by regulating the viewing depth of agents.

61 BIBLIOGRAPHY

[1] The internet movie database. The Internet Movie Database, March 2008 .

[2] Spirops crowd. SpirOps Crowd, March 2008 .

[3] EA . Command and conquer 3: Tiberium wars. Command and Conquer, April 2006 .

[4] Adriana Braun, Bardo E. J. Bodmann, and Soraia R. Musse. Simulating virtual crowds in emergency situations. VRST’05, November 2005.

[5] Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein. Chapter 16: Greedy algorithms. Introduction to Algorithms, 2001.

[6] Purves D and Lotto B. Why we see what we do: An empirical theory of vision. Sunderland, MA: Sinauer Associates, 2003.

[7] Blizzard Entertainment. Starcraft. Blizzard Entertainment, April 1998 .

[8] J. Funge and Demetri Terzopoulos. Cognitive modeling: Knowledge, reasoning and planning for intelligent characters. In Proceedings of ACM SIGGRAPH 1999, pages 29–38.

[9] Clark Gibson and John O’Brian. The basics of team ai. Gamasutra, March 2001 .

[10] J. K. Hodgins, W. L. Wooten, D. C. Brogan, and J. F. O’Brien. Animating human athletics. In Proceedings of Annual Conference on Computer Graphics and Interactive Techniques, pages 71–78, 1995.

[11] Tng Cheun Hou John, Edmond C. Prakash, and Narendra S. Chaudhari. Team ai: Probabilistic pathfinding. In Proceedings of the 2006 international conference on Game research and development, pages 191–198, 2006.

62 [12] Arno Kamphuis, Michiel Rook, and Mark H. Overmars. Tactical path finding in urban environments. 2005.

[13] Lucas Kovar, Michael Gleicher, and F. Pighin. Motion graphs. Proceedings of the 29th Annual Conference on Computer Graphics and Interactive Techniques, page 473482, 2002.

[14] Marc Lanctot, Nicolas Ng Man Sun, and Clark Verbrugge. Path-finding for large scale multiplayer computer games. In Proceedings of the 2nd Annual North American Game-On Conference (GameOn’NA 2006), pages 26–33, sept 2006.

[15] Patrick Lester. A* path finding for beginners. http://www.policyalmanac. org/games/aStarTutorial.htm, 2005.

[16] S. Musse and D. Thalmann. Hierarchical model for real time simulation of virtual human crowds. IEEE Transactions on Visualization and Computer Graphics, (7):152–164, 2001.

[17] Kian Bee Ng. Implementing a group behavioral control system using maya. Gamasutra, October 1999 .

[18] Hansrudi Noser and Daniel Thalmann. Sensor based synthetic actors in a tennis game simulation. Proc. Computer Graphics International, pages 189–198, 1997.

[19] Carol O’Sullivan, Justine Cassell, Hannes Vihjalmsson, and Simon Dobbyn. Crowd and group simulation with levels of detail for geometry, motion and be- haviour. Eurographics Irish Chapter, 2002.

[20] Amit Patel. Pathfinding. Game Programming, 2007 .

[21] Zoran Popovi´cand Andrew Witkin. Continuum crowds. In Proceedings of ACM SIGGRAPH 2006, pages 11–20.

[22] Torsten Reil. Animation 2.0. Computer Graphics World, 29, July 2006.

[23] Craig Reynolds. Flocks, herds, and schools: A distributed behavioral model. In Proceedings of ACM SIGGRAPH 1987, pages 25–34.

[24] Craig Reynolds. Steering behaviors for autonomous characters. 1999.

[25] Craig Reynolds. Crowd simulation on ps3. Game Developers Conference, 2006.

[26] Stuart J. Russell and Peter Norvig. A* search algorithm. Artificial Intelligence: A Modern Approach, pages 97–104, 2003.

63 [27] Wei Shao and Demetri Terzopoulos. Autonomous pedestrians. In Proceedings of ACM SIGGRAPH 2005, pages 11–20.

[28] David Silver. Cooperative pathfinding. 1st Conference on Artificial Intelligence and Interactive Digital Entertainment, 2005.

[29] EA Sports. Madden nfl 06. EA Sports, August 2005 .

[30] Scott B. Steinman, Barbara A. Steinman, and Ralph Philip Garzia. Foundations of binocular vision: A clinical perspective. McGraw-Hill Medical, 2000.

[31] Anthony Stentz. Optimal and efficient path planning for partially-known environ- ments. Proceedings IEEE International Conference on Robotics and Automation, May 1994.

[32] Mankyu Sung, Michael Gleicher, and Stephen Chenney. Scalable behaviors for crowd simulation. Eurographics, 2004.

[33] D Terzopoulos, J Platt, A Barr, and K Fleischer. Elastically deformable models. In Proceedings of ACM SIGGRAPH 1987, 21(4)(3):205–214.

[34] Demetri Terzopoulos. Artificial life for computer graphics. Communications of the ACM, 42(8):33–42, 1999.

[35] X. Tu and Demetri Terzopoulos. Artificial fishes: Physics, locomotion, percep- tion, behavior. In Proceedings of ACM SIGGRAPH 1994, pages 43–50.

[36] Wikipedia. Field of view. Wikipedia, March 2008 .

64