STEERING BEHAVIORS Markét 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 https:/ / www.youtube.com/ watch? v=PLkpfKiinTA MOTIVATION
Boid Particles S imulation, Blender https:/ / www.youtube.com/ watch? v=rLBrK0K-Ny8 MOTIVATION
BrainBugz https:/ / www.youtube.com/ watch? v=uRTo9qECQrM MOTIVATION
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]
Action S election S trategy, goals, path-planning STEERING BEHAVIORS - BASICS S teering Path determination • Hierarchy of mot ion behavior • Act ion select ion layer + Pat h-finding Locomotion Animation, articulation • 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
BOIDS & FLOCKING MODEL • Boid (bird like obj ect ) • Flocking Model 3 st eering rules Alignment Cohesion Separat ion • • Try t o move at t he Prefer t o be at t he • Do not get t oo close same speed and cent er of t he local t o nearby direct ion (velocit y) flockmat es flockmat es as nearby flockmat es • St eers agent t o t he • St eers boid from • St eers boid t o have cent er of nearby t oo close t he same velocit y as flockmat es flockmat es t he average of velocit ies of nearby flockmat es For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ boids/ [3]
Interactive Boids http:/ / blog.soulwire.co.uk/ laboratory/ flash/ as3-flocking- steering-behaviors FLOCKING DEMONSTRATION I.
FLOCKING MODEL - FEATURES • Relat ively believable • Relat ively fast • St raight forward implement at ion O(n 2 ) • 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
S tanley & S tella in: Breaking the Ice http:/ / www.youtube.com/ watch? v=3bTqWsVqyzE FLOCKING DEMONSTRATION II.
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
S eek steering force computation to_target = target_position – my_positin desired_velocity = normalize( to_target) * max_speed SEEK & FLEE steering = desired_velocity – velocity • Seek • st eers agent t o a st at ic t arget • Flee • st eers agent from a st at ic t arget For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ S eekFlee.ht ml [3]
Arrival steering force computation to_target = target_position – my_position ARRIVAL 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 • As Seek, except t he agent slows down as it approaches t he t arget For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Arrival.ht ml [3]
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]
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]
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]
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]
UNALIGNED COLLISION AVOIDANCE • Seeing head • Defined by const ant • Larger t he const ant • Sooner an obst acle is det ect ed For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
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]
UNALIGNED COLLISION AVOIDANCE • Seeing head • Defined by const ant • Larger t he const ant • Sooner an obst acle is det ect ed For figures and video see Craig Reynolds‘ web site http:/ / www.red3d.com/ cwr/ steer/ Unaligned.html [3]
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]
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
OBSTACLE AVOIDANCE & CONTAINMENT • • The most t hreat ening obst acle The agent ‘ s fut ure posit ion is is det ect ed and t he agent is predict ed and t he agent is st eered st eered from it t owards t he allowed region 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]
OBSTACLE AVOIDANCE •
Hitman Blood Money, 2009 http:/ / www.youtube.com/ watch? v=ycDi7fK797U (DYNAMIC) OBSTACLE AVOIDANCE EXAMPLE
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
OBSTACLE AVOIDANCE & LOCAL TRAPS
OBSTACLE AVOIDANCE & LOCAL TRAPS
OBSTACLE AVOIDANCE & LOCAL TRAPS
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]
Recommend
More recommend