real-time crowd simulation: a review - leggettnet · real-time crowd simulation: a review richard...

12
Real-Time Crowd Simulation: A Review Richard Leggett December 2004 Abstract This paper presents a review of current research in the area of real-time crowd simulation. Crowd simulation has many diverse uses, for example in safety modelling, entertainment software, architecture and urban mod- elling applications. We describe three main approaches to the problem - fluid-based, cellular automata and particle-based, concentrating on the latter. Finally, we describe CrowdSim, a simple but effective implemen- tation of some of the techniques. 1 Introduction In this paper, we present a review of research into the topic of real-time crowd simulation. We also describe the implementation of CrowdSim, a 2-dimensional simulation based upon some of the ideas presented in the paper. We define a crowd to be a collection of pedestrians occupying a common area and with varying degrees of interaction with each other. It is fair to ask the question of why we would want to model crowds. The following are some common reasons: Safety simulation - crowd simulation has been successfully used to model the flow of pedestrians in emergency situations, for example exiting a building on fire ([Helbing et al. 2000]). Architectural simulation - crowd models can be used to test the suitability of building designs and to enhance the realism of pre-construction models. Urban modelling - realistic pedestrians can add to the realism of virtual tourism ([Ulicny and Thalmann 2002]) and can be an aid to town plan- ning. Entertainment software - many modern computer games create virtual worlds for players to inhabit and these are enhanced by the realistic sim- ulation of pedestrians. It’s an interesting problem - apart from anything else, the modelling of pedestrians is an interesting mathematical problem. The topic is a large one and it’s therefore been necessary to restrict detail in some areas. In particular, we have chosen to focus less on visualisation, as much of the work is equally applicable in 2-dimensional applications as it is in 1

Upload: trinhdat

Post on 23-Jul-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Real-Time Crowd Simulation: A Review

Richard Leggett

December 2004

Abstract

This paper presents a review of current research in the area of real-timecrowd simulation. Crowd simulation has many diverse uses, for examplein safety modelling, entertainment software, architecture and urban mod-elling applications. We describe three main approaches to the problem- fluid-based, cellular automata and particle-based, concentrating on thelatter. Finally, we describe CrowdSim, a simple but effective implemen-tation of some of the techniques.

1 Introduction

In this paper, we present a review of research into the topic of real-time crowdsimulation. We also describe the implementation of CrowdSim, a 2-dimensionalsimulation based upon some of the ideas presented in the paper.

We define a crowd to be a collection of pedestrians occupying a commonarea and with varying degrees of interaction with each other. It is fair to askthe question of why we would want to model crowds. The following are somecommon reasons:

• Safety simulation - crowd simulation has been successfully used to modelthe flow of pedestrians in emergency situations, for example exiting abuilding on fire ([Helbing et al. 2000]).

• Architectural simulation - crowd models can be used to test the suitabilityof building designs and to enhance the realism of pre-construction models.

• Urban modelling - realistic pedestrians can add to the realism of virtualtourism ([Ulicny and Thalmann 2002]) and can be an aid to town plan-ning.

• Entertainment software - many modern computer games create virtualworlds for players to inhabit and these are enhanced by the realistic sim-ulation of pedestrians.

• It’s an interesting problem - apart from anything else, the modelling ofpedestrians is an interesting mathematical problem.

The topic is a large one and it’s therefore been necessary to restrict detailin some areas. In particular, we have chosen to focus less on visualisation, asmuch of the work is equally applicable in 2-dimensional applications as it is in

1

three dimensions. Whilst we’ve aimed to take a general view, the focus of ourinterest is the modelling of pedestrians in urban modelling applications, so thiswill inevitably restrict the detail given to some areas.

A review of the literature demonstrates three broad approaches to the sim-ulation of crowds:

1. Fluids - it can be observed that the motion of crowds at a macroscopiclevel is similar to the flow of fluids. Successful attempts have been madeto model pedestrians using the physical laws of fluid dynamics.

2. Cellular automata - discrete, dynamic, systems, which model a lattice ofcells and base the state of a cell on the states of the immediately surround-ing cells.

3. Particles - probably the majority of the work described in the literaturetakes this approach, often known as the atomic or particulate approach.Under this scheme, each pedestrian is considered as an individual entityand the interactions between it and the other pedestrians are individuallymodelled according to physical or social laws.

We can think of crowd simulation at both a macroscopic and a microscopiclevel. At the macroscopic level, we are interested in seeing a mass of people movewith a realistic motion, without necessarily being concerned by the movementof an individual. However, when we look at the microscopic level, we are indeedconcerned that each individual pedestrian moves in a convincing manner andwe may wish to focus on one pedestrian and watch its movement. Dependingon the application of the simulation, we may be more or less interested in thismicroscopic level. As we have stated, our interest is focussed towards urbanmodelling and for these applications, realistic behaviour at a microscopic levelis very much a requirement.

Generalising, it is fair to say that fluid-based approaches work best on themacroscopic level. Of the other two approaches, the particle approach is themost popular technique and there is most research in this area. For thesereasons, whilst we describe all three approaches, we will pay most attention tothe particle approach.

2 Some Observations on Pedestrian Behaviour

Before looking at solutions, we begin by noting some observations about the wayreal pedestrians move and the interactions between them. [Sung et al. 2004]make the point that crowds offer an anonymity. When we look at a crowd,we care about what is happening, not who is doing it. Therefore, the specificactions of individual pedestrians may appear relatively random, but the overalllook of the crowd can still be convincing. This ties in with earlier comments onaction at the macroscopic level.

[Helbing et al. 2001] provide a useful summary of research into real pedes-trian motion, mostly obtained from the analysis of video films. The main pointsare:

1. Pedestrians act automatically - they don’t reflect on their strategy in everynew situation. Behaviour is an optimised strategy which has been learnedover time by trial and error.

2

2. Pedestrians show an aversion to taking detours or moving opposite to thedesired walking direction (even if the direct route is crowded).

3. Pedestrians normally choose the fastest route to their next destination.

4. If alternative routes are the same length, a pedestrian will most likelychoose the one that keeps them going straight ahead for as long as possible.Unless the alternative route is more attractive for other reasons - such asless noise, safer environment, less waiting etc.

5. Pedestrians prefer to walk at their own individual, most comfortable walk-ing speed, so long as it is not necessary to go faster to reach the destinationin time.

6. Pedestrians keep a certain distance from other pedestrians and from ob-stacles. The distance is smaller as the pedestrian hurries and as the crowddensity increases.

7. Resting pedestrians are uniformly distributed over the available area ifthere are no acquaintances among the individuals.

8. Pedestrian density increases (and hence interpersonal distances decrease)around particularly ‘attractive’ places.

9. Individuals who know each other form groups and these groups can behaveas though they were a single entity.

[Loscos et al. 2003] make the observation that only around half of pedestri-ans in any typical scene walk alone, the rest walk in groups of varying sizes.Group behaviour is therefore key to realistic simulations. [Musse et al. 1998]define three main laws for group behaviour:

1. Pedestrians in the same group walk at the same speed

2. Pedestrians in the same group follow the same goals

3. Pedestrians in the same group will wait for each other if one pedestrian ismissing

In keeping with the Helbing observations, Loscos et al. also note that whencongestion occurs, people tend to create flow patterns by following the personin front.

Pedestrians don’t just walk indefinitely. Their journey usually starts in onebuilding and ends in another, and along the way they may perform variousactions. These actions might include window shopping, stopping to talk toanother pedestrian or queueing for a bus. For true realism, we also need tomodel these kinds of behaviour.

3 Three Approaches

3.1 Pedestrians as Fluids

Early work by [Henderson 1971] demonstrated that it was possible to modelpedestrian flow using the Navier-Stokes equations. These are a set of equationsthat govern the motion of non-turbulent, Newtonian fluid dynamics.

3

Work by Dirk Helbing builds on Henderson’s work and in [Helbing et al. 2001],he provides a summary of observations on the similarities between medium andhigh density pedestrian crowds and the motion of gases and fluids. Comparisonsbetween pedestrian flow and granular flow (eg. sand through an egg timer) arealso made.

[Hughes 2003] is another example of recent work which models crowd flowaccording to fluid equations. The author describes crowds as ‘thinking’ fluidsand uses his work to model scenarios as diverse as the Battle of Agincourt andthe annual Muslim Hajj.

3.2 Pedestrians as Cellular Automata

Cellular automata are discrete dynamic systems, whose behaviour is charac-terised by local interactions. A CA is made up of a regular lattice of cells, eachof which can have one of a finite number of states. In the traditional definitionof a CA, each unit of time the state of each cell is re-calculated based on theapplication of a set of rules to neighbouring cells. The most famous example ofthis is John Conway’s ‘Game of Life’ [Gardner 1970], where complex organic-likegrowth patterns can be observed by the application of very simple rules.

Extensions to the CA concept allow cells to be influenced not just by neigh-bouring cells, but by more remote cells also. Initially, these ideas were appliedto traffic flow, but later to the more complex problem of pedestrian modelling.

Some examples of cellular automata crowd work are [Blue and Adler 2000],[Dijkstra et al. 2000].

3.3 Pedestrians as Particles

The majority of pedestrian simulations take the particulate approach, sometimescalled the atomic approach.

Early influential work was that of Craig Reynolds [Reynolds 1987] whoworked on simulations of flocks of birds, herds of land animals and schools offish. Each particle, or boid, was implemented as an individual actor which navi-gates according to its own perception of the environment, the simulated laws ofphysics, and a simple set of behavioural patterns. Later work ([Reynolds 1999])extends the concepts to the general idea of ‘autonomous characters’, with anemphasis on animation and games applications.

[Bouvier et al. 1997] describe a generic particle model and apply it to boththe problem of pedestrian simulation and to the apparently distinct problem ofairbag deployment. They present software allowing the statistical simulation ofthe dynamic behaviour of a generic particle system. In their system, the particlesystem is defined in terms of:

• the particle types - mass, lifetime, diffusion properties, charge, drag, in-teractions with surfaces, visualisation parameters

• the particle sources (or generators) - size, geometry, rate and direction ofemission

• the 3D geometry, including obstacles

• the evolution of particles within the system

4

[Helbing and Molnar 1998] introduce a ‘Social force model for pedestriandynamics’. They suggest that the motion of pedestrians can be described as ifthey are subject to social forces which are a measure of the internal motivationof individuals to perform certain actions or movements. They describe threeessential forces:

1. Acceleration - the velocity of the pedestrian varies over time, as it attemptsto reach its optimum speed and as it avoids obstacles.

2. Repulsion - there is a repulsive force from other pedestrians and fromobstacles and edges.

3. Attraction - pedestrians are sometimes attracted by other people (eg.friends, street artists) or by other objects (such as window displays).

Putting these three forces together, Helbing produces an equation for apedestrian’s ‘total motivation’ and combining this with a term to allow forfluctuations in behaviour, produces the ‘social force model’. He goes on todescribe computer models based on the equations, which have been success-ful in demonstrating various observed phenomena, for example lane formation.In [Helbing et al. 2000], the social force model is applied to the simulation ofbuilding escape panic, with impressive results.

[Thalmann et al. 1999] model virtual humans according to perception, emo-tion and behaviour. In each tick of the virtual clock, they model the perceptionof each virtual human (what they can see, what is happening to them etc.),they model the effect on the emotion and then finally this is translated intobehaviour. [Ulicny and Thalmann 2001] build on the work to describe a rulessystem for individual pedestrians which determines their responses to varioussituations. An example rule would be:

FOR ALLWHEN EVENT = in_danger_area AND ATTRIBUTE fear > 50%THEN BEHAVIOR FLEE

[Sung et al. 2004] define a probabilistic model for pedestrians which allowsthem to move from one state to the next. These work in a similar manner toFinite State Machines, but the state graph and transition matrix are modifiedat run-time.

4 Deconstructing the Particle Approach

In the previous section, we have described the general approaches used by anumber of significant contributions to the field. In this section, we break downthe particle approach into three broad tasks - decision making and movement,group behaviour and collision avoidance.

4.1 Decision making and movement

[Loscos et al. 2003] use a 2-dimensional image map to represent a city layout andautomatically assign goals to street corners, based on detection of pavement-building-pavement boundaries in the map. The connected goals form a graph

5

of the city. The pedestrians are assigned a starting position and a starting goal.When they reach a goal, they are assigned one of the adjacent goals as thenext objective. Meanwhile, each pedestrian maintains a store of the last 3 goalsvisited, so that they don’t repeatedly double-back on themselves.

In the Loscos model, the flow of crowds also influences the movement of anindividual pedestrian. Each time a pedestrian reaches a position on the grid, itsdirection is stored. This direction field fades over time, but if a new pedestrianreaches the position before it has faded, the direction field is taken into accountby the new pedestrian.

[Musse et al. 1998] use a similar goal-based approach to the Loscos model,though they have two types - interest points and action points. Interest pointsare points a pedestrian must pass through, while at action points, the pedestrianis required to perform some form of action, for example stopping.

[Sung et al. 2004] use the Probabilistic Road Map as the basis for route se-lection, a method based upon Dijkstra’s shortest path algorithm and commonlyknown for its use in IP routers.

4.2 Group behaviour

[Musse and Thalmann 1997] concentrate on the interactions between groups ofpeople within crowds, and define a rule-based system for the transfer of pedes-trians from one group to another.

Groups in the Loscos model are defined by a leader and by members. Theleader makes all the decisions over direction and goals, with the members fol-lowing. The members still perform collision detection and avoidance, but theirbehaviour is heavily influenced by the leader.

[Braun et al. 2003] expand Helbing’s social force model. In their model, eachpedestrian is assigned a ‘family’ identifier and an ‘altruism’ level. These act asforces in the model to tend to make some of the pedestrians form groups withothers.

4.3 Collision avoidance

[Musse and Thalmann 1997] describe two methods of collision avoidance be-tween pedestrians:

• Type 1: Using simple mathematical equations (the intersection of twolines and distance from two points), we determine future positions andpredict a collision event. One of the pedestrians stops, allowing the otherto pass.

• Type 2: The preferred option - instead of waiting, the pedestrian canpredict the collision and change direction. However, sometimes, theremay be insufficient time to modify direction, so we use type 1 instead.

[Loscos et al. 2003] define three types of collision - frontal, following andperpendicular. They further define three collision distances - close, near andfar. These factors, together with the behaviour of the other party (waiting orwalking), and the pedestrian density (normal or congested) produce an actiontable for a pedestrian. Actions include varying the angle of the pedestrian’strajectory, it’s speed, or stopping entirely.

6

Figure 1: CrowdSim running.

[Feurtey 2000] introduces a method for collision detection based on project-ing future movements onto a cone of (x, y, t) space. He defines a cost functionthat enables pedestrians to evaluate the cost of moving away from their cur-rent trajectory. However, the method is not yet scalable to large numbers ofpedestrians.

Collision avoidance of static objects, such as buildings, is easier. In 2-dimensions, a common approach is to use a collision map. This is the approachused by Loscos et al., where the authors check for a collision a number of tilesahead in order to produce smoother avoidance movement.

5 CrowdSim

In this section, we describe the design of CrowdSim, a 2-dimensional crowdmodel, which was designed to explore some of the ideas described in this paper.Figure 1 shows an image of CrowdSim running. It presents a top-down view ofa network of city streets and represents individuals by triangles that point inthe direction of travel. A GUI allows the simulation to be slowed or paused,pedestrian trails and trajectories to be highlighted, collisions to be highlightedand various other options.

5.1 Overall design

The simulation was developed using the Java language and a UML class diagramis shown in figure 2. Each pedestrian is modelled by an instance of the Pedestrianclass, whose attributes entirely describe the state, speed and intentions of thepedestrian. The plan of the city is described by a bitmap image, with specificcolours used to mark buildings, pavement, road, pedestrian crossings and goals.This bitmap is processed before the simulation begins in order to identify goalpositions, crossings and to hide information from the viewer.

7

Figure 2: UML diagram showing the class structure of CrowdSim.

5.2 Pedestrian movement

The movement from one goal to another governs the basic trajectory of thepedestrians. When a pedestrian reaches its goal, a new goal is chosen from aninternal map of goal links (Figure 3). The pedestrian also maintains a ‘memory’of previous goals and, where possible, the next goal is chosen so that it is differentto all the memory goals.

Each time a pedestrian selects a new goal, the angle of the new trajectoryis calculated. This is used for collision analysis and for plotting the rotatedpedestrian icon. However, individual movement of the pedestrian at each cycleof the simulation is governed by a simple version of the Bresenham straight-linealgorithm ([Foley et al. 1994]).

5.3 Collision detection and avoidance

Collisions can take place between pedestrians and the scenery (for examplebuildings) and between pedestrians and other pedestrians. In our definition,collision detection is concerned with behaviour once a collision has occurred,while collision avoidance is concerned with taking actions to ensure a collisiondoesn’t happen in the future. In both cases, CrowdSim creates a temporarygoal to direct a pedestrian away from a collision. Once the pedestrian reachesthe temporary goal, it is then re-directed back to its original goal.

Where a collision has actually occurred, CrowdSim’s approach is to vary

8

Figure 3: Image showing goals (numbers) and links (lines).

the colliding pedestrian’s angle of movement by up to 90 degrees, creating anew temporary goal. In the case of collisions with buildings, this strategy tendsto pay off. The same is also true of low density concentrations of pedestrians.However, if after a number of attempts, this strategy has not brought success,the pedestrian will stop and wait for a small amount of time. It will againattempt to find a new temporary goal. If this again fails, as can happen incases of high congestion, the pedestrian will give up and move in the oppositedirection.

Avoidance behaviour is slightly more sophisticated. At each cycle of thesimulation, every pedestrian checks to see if any of the other pedestrians arewithin a defined radius. For each pedestrian that is, its position over the nextn cycles (with, typically, n=30 in our simulation) is calculated and comparedwith the calculated position of our test pedestrian. If the positions coincide,avoidance action is taken. The avoidance behaviour is dependent upon twofactors - the type of collision and the distance from the collision point.

As with the Loscos model ([Loscos et al. 2003]), we define three types ofcollision - frontal, following and perpendicular. And also like Loscos, we definethree distances - close, near and far. However, we adopt a slightly simplermodel, not considering the movement of the other pedestrian or the density ofthe crowd. Table 1 describes the actions taken in each situation.

The type of collision is decided by the difference in the directional anglebetween the two pedestrians. If the first pedestrian’s trajectory is within 30degrees either side of the second, then it is considered to be a following collision.If the trajectory is between 150 and 210 degrees different (ie. 180 plus or minus30 degrees), the collision is considered to be frontal. Anything that falls out ofthese ranges is considered perpendicular.

6 Conclusions

This paper has presented an overview of the current state of crowd simulationresearch, highlighting the potential shown by particle-based approaches. Ap-

9

CollisionType Distance ActionFront Far Fastest pedestrian takes avoiding actionFront Near Fastest pedestrian takes avoiding action

Slowest pedestrian slows down, or stopsFront Close Fastest pedestrian takes avoiding action

Slowest pedestrian stopsFollowing Far Fastest pedestrian takes avoiding actionFollowing Near Fastest pedestrian takes avoiding action and

slows downFollowing Close Fastest pedestrian takes on the speed of the

slower pedestrianPerpendicular Far Slowest pedestrian slows downPerpendicular Near Slowest pedestrian slows downPerpendicular Close Slowest pedestrian stops

Table 1: CrowdSim collision avoidance actions

plying some of these ideas, we have created a useful simulation based on somerelatively simple rules.

At low to medium pedestrian densities, the techniques used in CrowdSimcan produce realistic crowd motion, with pedestrians moving at different speeds,following believable trails and taking sensible avoidance action. At higher den-sities, the motion of some pedestrians becomes less smooth and further workcould be done to improve this. In particular, adopting a more complicatedcollision avoidance algorithm would improve the situation.

Aside from the collision avoidance algorithm, more time would have enabledwork on some other aspects of natural human interaction. Grouping of thepedestrians would improve realism, as would greater interaction with scenery -for example window shopping, bus stops and building entrances.

References

[Blue and Adler 2000] V. Blue, J. Adler, Cellular Automata Microsimulationof Bi-Directional Pedestrian Flows, Journal of the TransportationResearch Board, 1678:135-141, 2000.

[Bouvier et al. 1997] E. Bouvier, E. Cohen, L. Najman, From Crowd Simula-tion to Airbag Deployment: Particle Systems, a New Paradigm ofSimulation, J. Electronic Imaging, 6(1):94-107, 1997.

[Braun et al. 2003] A. Braun, S. Musse, L. de Oliveira, B. Bodmann, Model-ing Individual Behaviors in Crowd Simulation, Proc. of ComputerAnimation and Social Agents, 143-148, 2003.

[Dijkstra et al. 2000] J. Dijkstra, H. Timmermans, A. Jessurun, A Multi-AgentCellular Automata System for Visualising Simulated Pedestrian Ac-itivity, Proc. of the Fourth International Conference on CellularAutomata for Research and Industry, 29-36, 2000.

10

[Feurtey 2000] F. Feurtey, Simulating the Collision Avoidance Behavior ofPedestrians, Master thesis, The University of Tokyo, School of En-geenering, 2000.

[Foley et al. 1994] J. Foley, A. van Dam, S. Feiner, J. Hughes, R. Phillips, In-troduction to Computer Graphics, Addison-Wesley, 1994.

[Gardner 1970] M. Gardner, Mathematical Games: Conway’s Game of Life,Scientific American, 224:120-123, October 1970.

[Helbing and Molnar 1998] D. Helbing, P. Molnar, Social force model for pedes-trian dynamics, Physical Review, 51:4282-4286, 1998.

[Helbing et al. 2000] D. Helbing, I. Farkas, T. Vicsek, Simulating DynamicalFeatures of Escape Panic, Nature, 407:487-490, 2000.

[Helbing et al. 2001] D. Helbing, P. Molnar, I. Farkas, K. Bolay, Self-organizingPedestrian Movement, Environment and Planning B: Planning andDesign, 28:361-383, 2001.

[Henderson 1971] L. Henderson, The Statistics of Crowd Fluids, Nature,229:381-383, 1971.

[Hughes 2003] R. Hughes, The Flow of Human Crowds, Annual Review of FluidMechanics, 35:162-182, 2003.

[Loscos et al. 2003] C. Loscos, D. Marchal, A. Meyer, Intuitive Crowd Be-haviour in Dense Urban Environments using Local Laws, Proc.Theory and Practice of Computer Graphics 2003, IEEE ComputerSociety, 2003.

[Musse and Thalmann 1997] S. Musse, D. Thalmann, A Model of HumanCrowd Behaviour: Group Inter-Relationship and Collision Detec-tion Analysis, Proc. of Eurographics Workshop, 39-52, 1997.

[Musse et al. 1998] S. Musse, C. Babski, T. Capin, D. Thalmann, Crowd Mod-elling in Collaborative Virtual Environments, Proc. ACM Sympo-sium on Virtual Reality Software and Technology, 115-123, 1998.

[Reynolds 1987] C. Reynolds, Flocks, Herds and Schools: A Distributed Behav-ioral Model, Computer Graphics, 21(4):25-34, 1987.

[Reynolds 1999] C. Reynolds, Steering Behaviors for Autonomous Characters,¡Proc. of the 1999 Game Developers Conference, 1999.

[Sung et al. 2004] M. Sung, M. Gleicher, S. Chenney, Scalable Behaviors forCrowd Simulation, Computer Graphics Forum, vol. 23, no. 3 (Proc.of the Eurographics Conference), 2004, pp 519-528.

[Thalmann et al. 1999] D. Thalman, S. Musse, M. Kallmann, Virtual Humans’Behavior: Individuals, Groups and Crowds, Proc. InternationalConference on Digital Media Futures, British Computer Society,Bradford, UK, 1999.

11

[Ulicny and Thalmann 2001] B. Ulicny, D. Thalmann, Crowd Simluation forInteractive Virtual Environments and VR Training Systems, Proc.Eurographics Workshop on Animation and Simulation, 163-170,2001.

[Ulicny and Thalmann 2002] B. Ulicny, D. Thalmann, Crowd simluation forVirtual Heritage, Proc. First International Workshop on VirtualHeritage, 28-32, 2002.

12