2.7 Avoiding Dynamic Obstacles and Hazards Don DeLorenzo
Geraint Johnson – Computer Artworks Ltd. The Thing ► First/Third Person Shooter ► Squad Based ► Utilized Repulsion Vectors for dynamic obstacle avoidance ► Fear and Trust
Avoiding Dynamic Hazards ► A* or any other method we’ve seen handles long range movement These often deal poorly with dynamic obstacles ► Convincing short range obstacle avoidance Avoids walking into other agents Discovers dynamically blocked paths early
Ideal Path Direct Path ► Dynamic obstacles are obstacles capable of movement ► Agent should avoid obstacle smoothly, not bump into it on its way past, which looks bad, and is worse of obstacle is dangerous Obstacle Destination Agent
Repulsion Vectors In the direction of the agent from the obstacle Combine with destination direction via vector addition Update as agent moves Obstacle DestinationDestination Direction Desired Velocity Repulsion Agent
Calculating Vector Direction ► Repulsion of Agent ‘a’ from entity ‘e’ ► Total repulsion vector is sum of repulsion vectors from all dynamic obstacles ► Desired velocity is calculated using desired speed and destination and repulsion vectors
Repulsion Magnitude ► No single ‘correct’ value for m ae ► Desirable characteristics for heuristic: In the case of an obstacle not worth avoiding, m ae = 0 If the obstacle is too far away, m ae = 0 Otherwise, m ae inversely related to distance from a to e m ae should be larger if a and e are on collision course m ae should have clamped upper bound
Sidestepping ► If obstacle is located directly between agent and destination, either Ra will overpower Da and agent will never reach destination Da will overpower Ra and agent will collide with obstacle ► If angle between Ra and Da too large, add sidestep vector Destination a Obstacle RaRa DaDa VaVa Sidestep Repulsion
Realistic Sidestepping Agent BAgent A
Unworkable Repulsion ► Repulsion vector will never allow agent to reach destination ► Defer to higher level AI Ignore repulsion vector ► Obstacle can be pushed out of the way ► Obstacle is less dangerous than what agent is fleeing ► Obstacle is moving and will be gone in time Give up on this destination Agent Obstacle Destination
Oscillations ► Oscillations occur when agent is near multiple obstacles If one or more obstacles are non-hazardous, ignore them in calculation Otherwise, flag failure find a different path Time = t 0 Time = t 1 e1 e2 a a DaDa RaRa VaVa DaDa VaVa RaRa
The Thing
Conclusion ► Repulsion vectors from nearby entities are added to agent’s velocity ► Sidestepping vectors are added when velocity and repulsion are roughly opposite ► Oscillations preempted ► Adds realism with convincing short range avoidance ► Simple arithmetic – quick to calculate