Presentation is loading. Please wait.

Presentation is loading. Please wait.

REFERENCES: FLOCKING.

Similar presentations


Presentation on theme: "REFERENCES: FLOCKING."— Presentation transcript:

1 REFERENCES: HTTP://WWW.RED3D.COM/CWR/BOIDS/ FLOCKING

2 WHAT IS IT? A way to simulate "herds": Flock of birds Flock of fish Herd of wildebeest A group of enemies First image: http://www.hanskellner.com/2007/03/02/dusk-flock-of-birds-video/http://www.hanskellner.com/2007/03/02/dusk-flock-of-birds-video/ Second image: http://www.environment.ucla.edu/podcasts/article.asp?parentid=4002http://www.environment.ucla.edu/podcasts/article.asp?parentid=4002 Third image: http://virtualiansanity.blogspot.com/2010/09/lion-king-favorite-scenes.htmlhttp://virtualiansanity.blogspot.com/2010/09/lion-king-favorite-scenes.html Fourth image: http://en.wikipedia.org/wiki/Resident_Evil_4

3 BOID REPRESENTATION

4 BOID REPRESENTATION, CONT. Independent Steering? For most characters, the orientation should match the direction of the linear velocity Need a refresher on the math? Sometimes, you do want a separate facing direction… [optional] Max Speed (a scalar) Useful to keep speed under control Refresher (with vectors)? Image: http://www.atariage.com/screenshot_page.html?SoftwareLabelID=906

5 STEERING

6 STEERING, CONT.

7

8 FLOCKING OVERVIEW Every frame: Generate 0 or more steerings (force vectors) From a set of low-level behaviors Seek Flee Wander Avoid-another-boid Align Obstacle-avoid Each force vector is created considering only that behavior Combine these steerings into a single force vector Apply it using the position-/velocity-update formula.

9 LOW-LEVEL BEHAVIOR: SEEK max_accel

10 LOW-LEVEL BEHAVIOR: FLEE max_accel

11 LOW-LEVEL BEHAVIOR: WANDER Approach #1: Add random.uniform(-m, m) to heading. Generate a force vector in this direction Problem: tends to be "jittery" Approach #2: Every few seconds generate a new seek target. Problem: can be abrupt. Approach #3: Place a target n units in the heading direction Add random.uniform(-m,m) to it's rotation This is relative to the heading direction Seek towards this target Usually a little less "jittery" Even though the target itself is "jittery"

12 LOW-LEVEL BEHAVIOR: AVOID- ANOTHER-BOID Simple: If within n units, flee More advanced: Predict if we'll collide, and if so steer to avoid "Problem" cases: Moving parallel to each other -- no collision! Intersecting paths, but no hit. Calculating the correction force vector. Can also consider a "cone of vision"

13 LOW-LEVEL BEHAVIOR: ALIGN Given: a direction vector. Simple -- just accelerate in this direction!

14 LOW-LEVEL BEHAVIOR: OBSTACLE AVOID One approach: Usually you want to modulate the force based on distance.

15 BLENDING

16 BLENDING, CONT. Problems: Contradictory forces (Equlibria) Oscillating: If you gradually adjust weights, this shouldn't happen. Near-sightedness E.g. taking the wrong route in a maze. Combine this with A* to get around this. Behaviors that should take precedence: E.g. Wall-avoid if we're close; otherwise, 0.5 wander, 0.5 seek. Use a decision tree.

17 ADVANCED TOPICS Unit Coordination Formation (echelon, disc, etc.) Only using cone-of-vision Incorporation with A*


Download ppt "REFERENCES: FLOCKING."

Similar presentations


Ads by Google