SLIDE 1
STEERING BEHAVIORS Markt a Popelov, market a.popelova [ zavin ] mat - - PowerPoint PPT Presentation
STEERING BEHAVIORS Markt a Popelov, market a.popelova [ zavin ] mat - - PowerPoint PPT Presentation
STEERING BEHAVIORS Markt a Popelov, market a.popelova [ zavin ] mat fyz.cz 2013, Human-like Art ificial Agent s, MFF UK Jakub Gemrot , gemrot @ gamedev.cuni.cz 2015, Human-like Art ificial Agent s, MFF UK Red S ea, Fish S chool
SLIDE 2
SLIDE 3
MOTIVATION
Boid Particles S imulation, Blender https:/ / www.youtube.com/ watch? v=rLBrK0K-Ny8
SLIDE 4
MOTIVATION
BrainBugz https:/ / www.youtube.com/ watch? v=uRTo9qECQrM
SLIDE 5
REQUIREMENTS FOR MOTION CONTROL
- Responding t o dynamic environment
- Avoiding obst acles and ot her agent s
- Int eract ion wit h environment and ot her agent s
- Mot ion believabilit y
- Speed of comput at ion
- One possible solut ion: St eering Behaviors by Craig W. Reynolds
- 1986 Flocks, Herds, and Schools: A Dist ribut ed Behavioral Model [1]
- Boids & Flocking Model
- 1999 St eering Behaviors For Aut onomous Charact ers [2]
SLIDE 6
STEERING BEHAVIORS - BASICS
- Hierarchy of mot ion behavior
- Act ion select ion layer + Pat h-finding
- St eering (navigat ion) layer
- Locomot ion layer
- Simple vehicle model
- Scalars: mass, max_force, max_speed
- Vect ors: locat ion, velocit y, orient at ion
- One st eering force:
- accelerat ion = st eering_force / mass t runcat ed by max_force
- new_velocit y = original_velocit y + accelerat ion t runcat ed by max_speed
- new_locat ion = original_locat ion + new_velocit y
- Or we can use f orces as direct input s f or physical simulat or
Locomotion
Animation, articulation
S teering
Path determination
Action S election
S trategy, goals, path-planning
SLIDE 7
BOIDS & FLOCKING MODEL
- Boid (bird like obj ect )
- Flocking Model 3 st eering rules
Separat ion
- Do not get t oo close
t o nearby flockmat es
- St eers boid from
t oo close flockmat es Alignment
- Try t o move at t he
same speed and direct ion (velocit y) as nearby flockmat es
- St eers boid t o have
t he same velocit y as t he average of velocit ies of nearby flockmat es Cohesion
- Prefer t o be at t he
cent er of t he local flockmat es
- St eers agent t o t he
cent er of nearby flockmat es
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ boids/ [3]
SLIDE 8
FLOCKING DEMONSTRATION I.
Interactive Boids
http:/ / blog.soulwire.co.uk/ laboratory/ flash/ as3-flocking- steering-behaviors
SLIDE 9
FLOCKING MODEL - FEATURES
- Relat ively believable
- Relat ively fast
- St raight forward implement at ion O(n2)
- Using spat ial dat a st ruct ure for nearby flockmat es det ect ion O(n)
- Used in films and games
- E.g., Bat man Ret urns
SLIDE 10
FLOCKING DEMONSTRATION II.
S tanley & S tella in: Breaking the Ice http:/ / www.youtube.com/ watch? v=3bTqWsVqyzE
SLIDE 11
1999 C. REYNOLDS: STEERING BEHAVIORS FOR AUTONOMOUS AGENTS
- Seek & Flee
- Pursue & Evade
- Arrival
- Wander
- Obst acle Avoidance & Cont ainment
- Collision Avoidance & Unaligned collision avoidance
- Wall Following
- Pat h Following
- Leader Following
- Flow Field Following
SLIDE 12
SEEK & FLEE
- Seek
- st eers agent t o a st at ic t arget
- Flee
- st eers agent from a st at ic t arget
S eek steering force computation to_target = target_position – my_positin desired_velocity = normalize( to_target) * max_speed steering = desired_velocity – velocity
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ S eekFlee.ht ml [3]
SLIDE 13
ARRIVAL
Arrival steering force computation to_target = target_position – my_position distance = length( to_target ) ramped_speed = max_speed * ( distance / slowing_distance ) clipped_speed = min( ramped_speed, max_speed ) desired_velocity = to_target * ( clipped_speed / distance ) steering_force = desired_velocity – velocity
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Arrival.ht ml [3]
- As Seek, except t he agent slows down as it approaches t he t arget
SLIDE 14
PURSUE & EVADE
- As seek & flee, except t he t arget moves
- Agent predict s t he locat ion of t he t arget in t he next t ick of t he
simulat ion
- Predict ion based on dist ance
- Nearer t he t arget is,
less t he predict ion (T) is used
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ PursueEvade.html [3]
SLIDE 15
WANDER
- Type of random st eering: t he st eering direct ion on one frame is relat ed
t o t he st eering direct ion on t he next frame
- More believable t han t ot ally random st eering forces
- St eering force:
- At each t ime st ep a random offset is added t o t he wander direct ion
- The modified wander direct ion is const rained t o lie on t he big circle
- Const rict ion of t he st eering: big circle
- Const rict ion of t he offset : small circle
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Wander.ht ml [3]
SLIDE 16
WANDER
- St eering force:
- At each t ime st ep a random offset is added t o t he wander direct ion
- The modified wander direct ion is const rained t o lie on t he big circle
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Wander.ht ml [3]
SLIDE 17
UNALIGNED COLLISION AVOIDANCE
- Separat ion
- Agent is st eered from t oo close neighbors
- Unaligned collision avoidance
- Pot ent ial collisions wit h ot her agent s are predict ed
- Agent is st eered t o avoid t he sit e of t he predict ed collision
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
SLIDE 18
UNALIGNED COLLISION AVOIDANCE
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
- Seeing head
- Defined by const ant
- Larger t he const ant
- Sooner an obst acle is det ect ed
SLIDE 19
UNALIGNED COLLISION AVOIDANCE
- Det ect ion by simple relat ion of t he dist ance t o an obst acle cent er
- Only closest t hread is considered
- And t he avoidance force generat ed
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
SLIDE 20
UNALIGNED COLLISION AVOIDANCE
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
- Seeing head
- Defined by const ant
- Larger t he const ant
- Sooner an obst acle is det ect ed
SLIDE 21
LEADER FOLLOWING
- Agent is st eered t o follow a Leader (grey).
- St eering force consist s of:
- Arrival – t he t arget is slight ly behind leader
- Separat ion – t o prevent collisions wit h ot her followers
- If a follower finds it self in a rect angular region in front of t he leader,
it will st eer lat erally away from t he leader’s pat h
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ LeaderFollow.html [3]
SLIDE 22
OBSTACLE AVOIDANCE
- Obst acle det ect ion
- Navigat ion graph, navigat ion mesh, et c.
- Point cont ent
- Line t races
- …
- Obst acle Avoidance by C. Reynolds
- An imaginary cylinder in front of t he agent should be free
- If it is free, t he st eering force is zero vect or
- Ot herwise it is t he vect or from t he most t hreat ening obst acle
SLIDE 23
- The most t hreat ening obst acle
is det ect ed and t he agent is st eered from it
- The agent ‘ s fut ure posit ion is
predict ed and t he agent is st eered t owards t he allowed region
OBSTACLE AVOIDANCE & CONTAINMENT
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Obstacle.html [3] http:/ / www.red3d.com/ cwr/ steer/ Containment.ht ml [3]
SLIDE 24
OBSTACLE AVOIDANCE
SLIDE 25
(DYNAMIC) OBSTACLE AVOIDANCE EXAMPLE
Hitman Blood Money, 2009 http:/ / www.youtube.com/ watch? v=ycDi7fK797U
SLIDE 26
PROBLEMS AND DISCUSSION OF OA USE
- Problems wit h obst acles det ect ion
- Narrow obst acles
- Obst acles may not be det ect ed
- Obst acles may be det ect ed wrongly
- Ray lengt h
- Quick react ions vs. narrow passages
- Simulat ion frequency
- Specific sit uat ions
- Front collisions
- Local t raps and complicat ed sit uat ions
- OA uses only local informat ion
SLIDE 27
OBSTACLE AVOIDANCE & LOCAL TRAPS
SLIDE 28
OBSTACLE AVOIDANCE & LOCAL TRAPS
SLIDE 29
OBSTACLE AVOIDANCE & LOCAL TRAPS
SLIDE 30
WALL FOLLOWING
- Agent is st eered t o move in parallel wit h a wall
- The fut ure agent ‘ s posit ion is predict ed (t he black dot )
- This fut ure posit ion is proj ect ed t o t he nearest point on a wall (red dot )
- Red line represent s t he wall’s normal and leads t o t he t arget point (red
circle)
- Seek behavior is used t o st eer agent t owards t he t arget point
- Surface prot ocol:
- t he nearest point on t he wall
- t he normal at t hat point
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Wall.ht ml [3]
SLIDE 31
WALL FOLLOWING
- Not es on possible implement at ion:
- Wall is det ect ed by rays
- At t ract ive force t o wall
- The fart her from wall an agent is, t he bigger t he at t ract ive force is
- Repulsive force from wall – if t he agent is t oo close t o wall
- The closer t o wall t he agent is, t he bigger is t he repulsive force
- Special sit uat ions
- Edges
- Front collisions
SLIDE 32
WALL FOLLOWING – DEMO I.
SLIDE 33
WALL FOLLOWING DEMO II.
SLIDE 34
WALL FOLLOWING IN COMBINATION
TA + OA
direct ly t hrough cit y
TA + WF
on t he sidewalks
SLIDE 35
FLOW FIELD FOLLOWING
- Flow field defines mapping: locat ion flow vect or
- May be defined procedurally / based on dat a
- May be st at ic / t ime-varying
- The fut ure locat ion is predict ed
- F = flow vect or at t his locat ion
- st eering_force = velocit y – F
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ FlowFollow.html [3] Vector-field Pathfinding https:/ / www.youtube.com/ watch? v=Bspb9g9nTto
S upreme Commander 2, 2010 http:/ / www.youtube.com/ watch? v=j A2epda-RkM
SLIDE 36
COMBINING STEERING BEHAVIORS
- Each st eering behavior ret urns single vect or
(st eering force)
- What t o do wit h more st eering behaviors?
- Select and apply t he most import ant st eering behavior
- Select random act ive st eering behavior
- Sum all forces t oget her
- Average of all forces
- Average of all non-zero forces
- Weight ed average of all non-zero forces
SLIDE 37
STEERING BEHAVIORS FOR IVA‘ S
- Which mot ion problems do we deal wit h in applicat ions wit h IVA‘ s?
- Where would be st eering behaviors helpful?
SLIDE 38
REAL EXAMPLE I.
No collision avoidance S tronghold Crusader Extreme, 2008 http:/ / www.youtube.com/ watch? v=IZpgMnu_lAk
SLIDE 39
REAL EXAMPLE II.
S mall collision radius Dawn of War, 2009 http:/ / www.youtube.com/ watch? v=IZpgMnu_lAk
SLIDE 40
REAL EXAMPLE III.
Primitive (and slow) collision avoidance Knights and Merchants, 1998 http:/ / www.youtube.com/ watch? v=IZpgMnu_lAk
SLIDE 41
REAL EXAMPLE IV .
Getting stuck Empire Total War, 2009 http:/ / www.youtube.com/ watch? v=IZpgMnu_lAk
SLIDE 42
PROBLEMS OF LOCAL INFORMATION
- Complicat ed t asks can not be solved
- What t o do?
- use global knowledge of t he environment
- plan t he pat h
SLIDE 43
DIRECT FOLLOWING OF THE PLANNED P ATH
SLIDE 44
PROBLEMS OF DIRECT FOLLOWING
- Not believable
- Somet imes lacks smoot hness
- What t o do?
- st eering behavior Pat h Following
- Paramet ers: pat h (a list of locat ions), dist ance from pat h
- Not es on implement at ion
- Pair of pat h nodes
- Force t o t he cent er axis
- Improvement s
- Proj ect ion lengt h
- Regulat ion force
SLIDE 45
P ATH FOLLOWING
- Agent is st eered t o move along t he pat h in t he given direct ion while
keeping it s cent er in t he gray region
For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ PathFollow.html [3] http:/ / www.red3d.com/ cwr/ steer/ CrowdPath.ht ml [3] GameDev Tutorials http:/ / gamedevelopment.t utsplus.com/ tutorials/ understanding-steering-behaviors-path-following--gamedev-8769
SLIDE 46
PEOPLE (COLLISION) AVOIDANCE
- Basics
- Repulsive force from ot her t oo close agent s
- Problems
Circumvention
(rotational force)
Acceleration &
deceleration 1 2
SLIDE 47
PEOPLE AVOIDANCE – DEMONSTRATION
SLIDE 48
OTHER SOCIAL INTERACTIONS
- Leader Following
- Walk Along [10]
- Two friends go t oget her t o a cert ain place
- Ot her…
?
SLIDE 49
WALK ALONG - DEMONSTRATION
SLIDE 50
ACTION SELECTION LAYER
- Which st eering behavior should be act ive?
- Paramet ers?
- Should be cont rolled by act ion select ion layer
- Aut onomously vs. Cent rally
- Some problems could be solved on t he act ion select ion layer
- Pat h Following vs. Ot hers
- Commander and his regiment
- Det ect ion of being st uck, et c.
- Set t ing paramet ers according t o mood, emot ions et c.
Locomotion
Animation, articulation
S teering
Path determination
Action S election
S trategy, goals, planning
SLIDE 51
STEERING BEHAVIORS CONCLUSION
- Advant ages
- Simplicit y predict abilit y (good for debugging)
- React ive behavior efficiency (t ime, memory)
- Forces smoot hness, combinabilit y
- Disadvant ages
- Simplicit y & Local Traps low believabilit y somet imes we need
higher-level predict ion and planning
- Scalabilit y (modifying t he behavior by hacking ext ra lines int o code)
- Use
- Comput er games, Films
- Crowd simulat ions (evacuat ions, shopping cent ers, et c.)
SLIDE 52
WORKSHOP
- St eeringTool 2.0
- St eeringGame
- UT2004St eeringLibrary
Web & Instalator: http:/ / diana.ms.mff.cuni.cz/ pogamut-games Proj ect S teeringGame
SLIDE 53
LITERATURE I.
1. REYNOLDS, Craig W. Flocks, Herds, and Schools: A Dist ribut ed Behavioral
- Model. In Proceedings of Comput er Graphics. Anaheim, California : ACM
SIGGRAPH, 1987. Pages 25-34. WWW: <ht t p:/ / www.red3d.com/ cwr/ papers/ 1987/ SIGGRAPH87.pdf>. 2. REYNOLDS, Craig W. St eering Behaviors For Aut onomous Charact ers. In Proceedings of Game Developers Conference. San Francisco, California : Miller Freeman Game Group, 1999. Pages 763-782. WWW: <ht t p:/ / www.red3d.com/ cwr/ papers/ 1999/ gdc99st eer.pdf>. 3. REYNOLDS, Craig W. St eering Behaviors For Aut onomous Charact ers [online]. Sept ember 5, 1997 , June 6, 2004 [cit . 2011-05-19]. St eering Behaviors For Aut onomous Charact ers. WWW: <ht t p:/ / www.red3d.com/ cwr/ st eer>.
Basics, Craig Reynolds, Boids, and
- riginal S
teering Behaviors
SLIDE 54
LITERATURE II.
4. CHAMP ANDARD, Alex J. AI Game Development : Synt het ic Creat ures wit h Learning and React ive Behaviors. First print ing. Unit ed St at es of America : New Riders Publishing, 2003. ISBN 1-5927-3004-3. 5. CHAMP ANDARD, Alex J. AI Game Programming Wisdom 2. First Edit ion. Unit ed St at es of America : Charles River Media, 2004. An Overview of Navigat ion Syst em, Pages 131-139. ISBN 1-58450-289-4. 6. SINGH, Shawn, et al. Wat ch Out ! A Framework for Evaluat ing St eering
- Behaviors. In Mot ion in Games : First Int ernat ional Workshop, MIG 2008
Ut recht , The Net herlands, 2008 Revised Papers. Germany : Springer- Verlag, 2008. Pages 200-209. ISSN 0302-9743. 7. KARAMOUZAS, Ioannis, et al. A Predict ive Collision Avoidance Model for Pedest rian Simulat ion. In Mot ion in Games : Second Int ernat ional Workshop, MIG 2009 Zeist , The Net herlands, 2009 Proceedings. Germany : Springer-Verlag, 2009. Pages 41-52. ISSN 1867-8211.
Related works, Benchmark for S teering Behaviors, Collision Avoidance Model
SLIDE 55
LITERATURE III.
8. POPELOVÁ, Markét a; BÍDA, Michal. St eering t echinky pro virt uální agent y. In KELEMEN, Jozef; KVASNIČKA, Vladimír; POSPÍCHAL, Jiří.
Kognice a umělý život XI. Opava : Slezská univerzita v Opavy, 2011. Pages
207-212. ISBN 978-80-7248-644-1. 9. POPELOVÁ, Markét a. Knihovna st eering t echnik pro virt uální agent y. Bachelor t hesis. Charles Universit y in Prague, 2011. WWW: <ht t p:/ / amis.mff.cuni.cz/ emohawk/ > (8.1.2012).
- 10. POPELOVÁ, Markét a, et al. When a Couple Goes Toget her: Walk Along
St eering. In Proceedings of Mot ion in Games, Lect ure Not es in Comput er
- Science. Volume: 7060, Springer, Heidelberg, Pages 278-289, ISBN 978-3-