Crowd Simulation & Script Languages 數位內容學院 遊戲開發研究班第一期 3D圖學 沈育德 Edward Shen May 26, 2005
Course Information • Date: 5/19, 5/21, 5/26, 5/28 (2005) • Lecturer: Edward Yu-Te Shen 沈育德 • Course Website: http://graphics.csie.ntu.edu.tw/~edwards/dokuwiki/doku.php?id=lecture
Schedule • Artificial Lives: Fishes and Evolving Creatures (Saturday, May 21) • Crowd Simulation & Script Languages (Thursday, May 26) • An Individual-Based Approach • An Hierarchical Approach: Crowds, Groups, and Individuals • Improv & Script Languages • Collision Detection and Bounding Boxes (Saturday, May 28)
Crowd Simulation & Script Languages • Introduction • An Individual-Based Approach • An Hierarchical Approach: Crowds, Groups, and Individuals • Improv & Script Languages
Crowd Simulation • Individual behaviors are difficult to model. As soon as we consider several individuals and the interrelationships between them, the complexity of the system is substantially increased. • If the application is to be processed in real time (including interactive aspects), a reasonable frame rate is required.
Terminology (I) • Virtual human agents: (or an agent) humanoids whose behaviors are inspired by those of humans’ • Groups & Crowds:The term group is used to refer to a group of agents whereas crowd is defined as set of groups. • Entities:Crowd, groups and agents constitute the entities of the simulation.
Terminology (II) • Intentionscorresponds to goals of the entities (e.g. go to the bank), beliefs represents internal status of the entities (e.g. emotional status) while knowledgedescribes information of the virtual environment where the crowd is to be simulated (e.g. location of obstacles). • Crowd behaviorcorresponds to a set of actions applied according to entities’ intentions, beliefs, knowledge and perception. • Eventsrepresent the incidence of something causing a specific reaction, which can change the group behaviors.
Related Work • Modeling the motion of groups with significant physics • Particle systems [Bouvier] • Crowd simulation with dynamics [Brogan] • Distributed behavior model for simulating flocks [Reynolds] • Methods to simulate the movement of pedestrians [Helbing] • Local rules for controlling collective behaviors [Matraric, Noser] • Behavioral animation for creating artificial life [Terzopoulos] • Presenting the problem of building autonomous animated creatures for interactive virtual environments [Blumberg] • IMPROV: a system for scripting interactive actors [Perlin]
Related Work (cont’d) • Simulating crowds of ants in an automatic way [PDI, PIXAR] • ‘Bugs Life’: 4466 different individual motions to describe 228 different behaviors
Applications • Computer Games • Shared Virtual Worlds • VR training systems
Goal • Ideally, to have a complete model of the world • Focusing on aspects allowing us to sufficiently model a subset that is applicable • 3D visualization in real-time • Excluding long-term social behaviors/migrations discussed in sociology
Main Challenges • Variety • All levels, including visualization, motion control, animation, sound rendering, etc • Efficient management is needed • Speed/Interactivity • CPU time • Memory space • Scalability
Crowd Simulation & Script Languages • Introduction • An Individual-Based Approach • Levels of Variety • The Model of the World • Behavior Model • System Implementation • Results • An Hierarchical Approach: Crowds, Groups, and Individuals • Improv & Script Languages
Ulicny B., Thalmann D. (2002) Towards interactive real-time crowd behavior simulation. Computer Graphics Forum 21, 4, 767–775.
Levels of Variety • Variety: “the quality or state of having different forms or types” (Weber Dictionary) • Subtle variations in the motions or look may greatly enhance the realism of the whole crowd
LV0 LV1 LV2 Three Levels of Variety • LV0: Single solution for a given task • LV1: Choosing from a finite number of solutions • LV1+: Solution can be composed of combinations of sub-solutions • LV2: infinite possible solutions • LV1 & LV2 are perceptually the same • So in practice, LV1 is feasible Adding a solution set for selection Needs generative models
Notes on LOV • Most AI/graphics techniques are not designed with the aim of achieving variety • E.g., Goal of path-finding algorithms is to find the best solution, which may result in unreal simulation • However, uniform visualization could help to emphasize problems with the flow of fleeing people in emergency egress simulation
The Model of the World Random displacements surrounding the path nodes ensure LV2 variety Interactions: physical (agent on fire) or perceptual perceiving a distant danger) Buildings & Trees Fire, gas clouds, etc Low-level actions include playing body animation sequences, walking with computed gaits, display facial sequences, etc
Behavior Model • Aim: simple enough to allow real-time animation, but still be sufficiently complex to provide interesting behaviors • Highest-level Rules • Selection: for who (particular agent or group) • Condition: when the rule is applicable • Consequent: what is the consequence of rule firing • According to the experience, it is more practical to store the rules all together in a rule base (as opposed to each agent keeping their own)
Rule Example • Variety is achieved by different attributes (caused by different initial values or histories)
Lower Levels of theBehavior Model • Middle levels are implemented using hierarchical finite state machines (FSMs) • Each behavior realized by one FSM, and can call other FSMs to delegate sub-tasks (e.g. path following) • Scripted sequential behaviors and autonomous complex behaviors can be mixed as needed • Lower levels resolve higher levels’ requests • Random playback speed to achieve varieties even executing the same behavior
System Implementation • Clear separation of the model part (computing behaviors) and the visualization part (displaying behaviors) • Agents, objects, and environment can be run without graphical output • Allowing different representations, and simplified visualizations can shorten the development cycles
System Implementation (cont’d) • Different update rates for different components • Higher level behavior computation can be run with much lower frequency than lower-level motion control • Lower level control can again be run slower than screen refresh rate
Results (I): Emergency Simulation • Reproducing scenarios depicting urban emergency situations involving crowds of virtual humans • A realistic 3D virtual population is constructed by automatic low-cost modeling: • H. Seo, et. al (2002) GENESIS: Generation of E-Population Based on Statistical Information", Computer Animation, pp.81~85., June, 2002
Results (I): Worshippers • Challenge: praying ceremony • A single sequence of motion-captured animation had to be reused • After finishing the animation, each sending an event announcing the end of the step, and the leader can proceed to the next one
Summary • Levels of Variety • L0, L1, L2 • The Model of the World • Agents, Objects, Environment • Behavior Model • System Implementation • Independent design of behavior modeling and visualization • Different update rates in different levels
Crowd Simulation & Script Languages • Introduction • An Individual-Based Approach • An Hierarchical Approach: Crowds, Groups, and Individuals • Levels of Variety • Crowd structure • Crowd information • ViCrowd architecture • Behaviors • Results • Improv & Script Languages
Introduction • ViCrowd • A behavioral-based multi-level framework to simulate virtual human crowds in real time • Concepts • Virtual human agent • Simulation Entity = Crowd + Groups + Agents • crowd: set of groups, group: a group of agents • Intentions, beliefs, knowledge • Crowd behavior • Events
Introduction (cont’d) • Problems • Modeling of crowd information and hierarchical structure, also concerning its distribution among groups • Different levels of realism: variation in behavior complexity • The required structure to provide interaction with groups of agents during the simulation in real-time
Introduction (cont’d) • Solutions • A hierarchy composed of crowd, groups, and agents is used Crowd structure • Endowing virtual agents with different levels of autonomy Crowd behavior (programmed, reactive, autonomous, guided)
Introduction (cont’d) • Group based model • Automatic generation of human crowds based on groups • Groups are more intelligent than individuals. • Real time Requirements and information optimization • Based on flocking systems • Contributions • Multi-level hierarchy • Various degrees of autonomy • Group-based behaviors
Crowd Structure • Distributing the crowd behaviors to the groups and then to the individuals
Crowd Structure (cont’d) • Two ways of setting the parameters • Scripted control: defines scripted behaviors of the crowd • External control: specifies guided behaviors • The intelligence, memory, intention and perception are focalized in the group structure.
Crowd Information • Knowledge/belief/intention
Knowledge • Information of the virtual environment • “The real position of a chair” • Concerns the memory of groups related to the past experiences as well as perception related to agents and groups. • Crowd obstacles • Crowd motion and action • Group Knowledge
Crowd obstacles • Declaration of all objects of the scene • Declaration of the areas where the crowd can walk. • Declaring some regions where the crowd can walk with some obstacles to be avoided
Crowd Information • Knowledge • Crowd motion and action • Described using goals • Goals = IP + AP • Individual AP • Shared AP • The agents from the same group share the same goals. • The paths for the different agents from the same group can be similar but are never the same because they cannot occupy the same sub-region.
Crowd Information (cont’d) • Knowledge • Group knowledge • Memory • A structure where the leader’s perceived information can be stored and processed afterwards depending on the specified behavioral rules “The memory of groups is processed only by the leader of the group” • The size of the memory (capacity of storage) can be pre-defined for each group of crowd. • Group perception • Some group associated parameters: knowledge, beliefs and intentions • Location of groups/agents • Associated to just the leader of group
Crowd Information (cont’d) • Beliefs • Emotion + the list of behaviors to be applied by the groups • Can be shared or be redefined. • Crowd and group behaviors • High-level behaviors for crowds programmed in the script language or directly informed using guided control • 8 group behaviors • Flocking, following, goal changing, attraction, repulsion, split, space adaptability, safe-wandering
Crowd Information (cont’d) • Beliefs • Crowd and group behaviors • Flocking • Group ability to walk together at the same speed towards the same goals • “In real life, people walk in groups” • Rules for flocking • The agents from the same group share the same list of goals; • They walk at similar speeds; • They follow the paths generated in Section 3.2.1; • One agent can wait for another on arrival at a goal when another agent from the same group is missing;
Crowd Information (cont’d) • Beliefs • Crowd and group behaviors • Following • Group ability to follow a group or an individual motion • Permanent/temporary • Goal changing • Agents can have the intention of changing groups • The relationship with all groups • Its domination status