1 / 58

Group Behaviors and Artificial Life

Group Behaviors and Artificial Life. Claire O’Shea COMP 259 – Spring 2005. Overview. Motivation “Flocks, Herds, and Schools” “Artificial Fishes” “Cognitive Modeling” “Constrained Animation of Flocks” Summary. Motivation.

raine
Download Presentation

Group Behaviors and Artificial Life

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Group Behaviors and Artificial Life Claire O’Shea COMP 259 – Spring 2005

  2. Overview • Motivation • “Flocks, Herds, and Schools” • “Artificial Fishes” • “Cognitive Modeling” • “Constrained Animation of Flocks” • Summary

  3. Motivation • Many animations require natural-looking behavior from a large number of characters • Flock of birds • School of fish • Crowd of people

  4. Motivation • How do we generate this motion? • Keyframe every character • This is very labor-intensive, usually ends up looking unrealistic OR... • Let each character generate its own motion! • Much easier, and produces natural, unscripted motion

  5. Motivation • Questions about this method • How do we write rules to define natural behavior? • Can self-directed characters do anything “intelligent”? • How can we give the animator some control over the scene? We’ll find out in the papers…

  6. “Flocks, Herds, and Schools: A Distributed Behavioral Model” Craig W. Reynolds, 1987

  7. “Flocks, Herds, and Schools” • “A flock is simply the result of the interaction between the behaviors of individual birds.” • Model a flock of “boids” (bird-oids) as a particle system • Each particle has an orientation • Behavior of one particle depends on other particles

  8. “Flocks, Herds, and Schools” • Modeling boid flight • The boid itself can move only in one direction (“forward” along its local positive z-axis) • The boid steers by rotating about its local x and y axes • The boid’s local coordinate system can move and rotate freely within world coordinates

  9. “Flocks, Herds, and Schools” • Modeling boid flight • Banking turns • The y-axis is always aligned with the direction of acceleration • During straight flight, this is gravity • During a turn, radial forces cause the bird to “bank” (rotate around its z-axis)

  10. “Flocks, Herds, and Schools” • Modeling boid flight • Gravity is used only to help define banking angle; it is not actually applied as a force • Upper bounds are set on speed and acceleration • Other forces (buoyancy, drag) are not modeled

  11. “Flocks, Herds, and Schools” • Modeling flocking behavior • Three basic rules, each of which generates an acceleration request • Collision Avoidance • Avoid running into other boids or static obstacles • Velocity Matching • Match velocity with nearby flockmates • Flock Centering • Stay close to nearby flockmates

  12. “Flocks, Herds, and Schools” • Combining acceleration requests • Weighted average • Fails in certain critical situations (ex. imminent collisions) • Prioritized allocation • Acceleration requests are accepted in priority order, until the maximum acceleration is reached • Works well (at least for this simple system)

  13. “Flocks, Herds, and Schools” • Simulated Perception • All the behavior rules depend only on nearby objects • An individual boid is only aware of other boids which lie in a spherical region around it • Sensitivity falls off as the inverse square of the distance

  14. Demo: A flock of boids

  15. “Artificial Fishes: Physics, Locomotion, Perception, Behavior” Xiaoyuan Tu and Demetri Terzopoulos, 1994

  16. “Artificial Fishes” • Simulate a fish using a “holistic model” • Physical form • Movement • Perception • Behavior

  17. “Artificial Fishes” • Fish Physics • Spring-mass model • 23 point masses, 91 springs • External springs are “muscles” • Fish moves by changing the rest length of these springs!

  18. “Artificial Fishes” • Fish Movement: Swimming • Fish swings its tail back and forth by alternately contracting and relaxing the muscles on each side • Displacement of water produces a reaction force normal to the fish’s body (Fiw) • {r1, s2, r2, s2} – amplitude and frequency of muscle contractions • Control amount of force, and thus swimming speed • Optimal values found experimentally A reaction force (Fiw) is applied at point ni and acts along the inward normal. It propels the fish both sideways and forward.

  19. “Artificial Fishes” • Fish Movement: Turning • Fish quickly contracts the muscles on one side while relaxing them on the other • {r0, s0, r1, s1} – contraction amplitude and frequency of the turning muscles • Experimentally determined for turns of 30, 45, 60, and 90 degrees • Arbitrary turns are generated by interpolating these parameters

  20. “Artificial Fishes” • More Fish Movement • Pitch and yaw are controlled by the pectoral fins • Force applied on the fins: • Raising or lowering the leading edge of the fin makes the fish swim up or down • Setting the two fins at different angles causes fish to roll • Setting fins perpendicular to body decreases forward speed fish’s velocity angle of fin to body surface area fin’s normal vector

  21. “Artificial Fishes” • Fish Perception • Simplified simulation of vision • Fish can see things that are within its viewing volume (a 300 degree solid angle around its head) and not occluded • Radius of viewing volume determined by translucency of the water

  22. “Artificial Fishes” • Fish Behavior • Fish behavior is influenced by several factors • Individual habits (preset by animator) • Mental state (functions evaluated at each timestep) • Perceived environment • Intention generator picks an intention based on these factors.

  23. “Artificial Fishes” • Fish Behavior • Mental state Hunger: Libido: Fear: digestion rate time since last meal appetite amount eaten libido function time since last mating distance to predator i fear of predator i

  24. “Artificial Fishes” • Intention Generator • Decides on a behavior based on mental state and priority ordering: • Check for imminent collisions • Check for nearby predators (calculate F(t)) • Evaluate hunger and libido (H(t) and L(t)) • Evaluate happiness with the ambient conditions

  25. “Artificial Fishes” A complete fish model:

  26. “Artificial Fishes” • Different types of fish can be created just by changing the intention generator! Predator: Prey:

  27. Demo: Foraging Fish

  28. “Cognitive Modeling: Knowledge, Reasoning and Planning for Intelligent Characters” John Funge, Xiaoyuan Tu, and Demetri Terzopoulos, 1999

  29. “Cognitive Modeling” • Builds on the idea of a holistic character model, but adds another layer: cognitive modeling • Character can learn about its environment • Character can plan ahead to achieve goals

  30. “Cognitive Modeling” • Some AI background: situation calculus • Situation: a description of the state of the world at a given time • Fluent: a property of the world that can change over time • Primitive action: function that translates from one situation to another situation • Precondition axiom: a statement about the state of the world before the primitive action • Effect axiom: a statement about the state of the world after the primitive action

  31. “Cognitive Modeling” • Situation calculus examples: (These examples are in CML, a language developed for this paper) Fluent: Broken(x, s) Precondition axiom: action drop(x) possible when Holding(x) Effect axiom: occurrence drop(x) results in Broken(x) Whether x is broken in situation s A primitive action

  32. “Cognitive Modeling” • Domain knowledge specification • Character should not have perfect knowledge of the world; this is unrealistic and uninteresting. • A better model: character makes plans based on limited information, “knows” when it needs more information • Need a way to express uncertainty about aspects of the world!

  33. “Cognitive Modeling” • Interval-valued Epistemic Fluents • The usual way to represent uncertainty in AI is with epistemic κ-fluents, but these are difficult to implement. • An alternative is to use interval arithmetic! • For each sensory fluent f, introduce an interval-valued epistemic fluent If. • The width of the IVE fluent expresses uncertainty about the value of f.

  34. “Cognitive Modeling” • Interval-valued Epistemic Fluents: Example speed(x, s): the speed of object x in situation s Ispeed(s): what the character “thinks” the speed of x is in situation s Suppose we know the speed at s0: speed(x, s0) = 20 Ispeed(s0) = <20, 20> As time goes on, we are less certain about the value! speed(x, s1) = 25 Ispeed(s1) = <10, 30>

  35. “Cognitive Modeling” • Character direction • A character can “plan” by finding a sequence of primitive actions that accomplish a goal • Equivalent to searching a tree • Complexity: exponential in the length of the plan! • Animator can “prune” the search space by specifying complex actions (sequences of primitive actions) • Results in nondeterministic behavior; the same goal can be accomplished in many different ways!

  36. “Cognitive Modeling” • Creating an animation with “smart” characters • Still need all the lower-level modules (physics, perception, behavior, etc) • Add a reasoning engine to choose a low-level behavior!

  37. “Cognitive Modeling” • Example: Prehistoric world • A T-Rex wants to chase raptors out of its territory • It knows that they will run away when it approaches, so it “herds” them out

  38. “Cognitive Modeling” • Example: Undersea world • A merman tries to escape from a shark • The merman hides behind obstacles, so that the shark can’t see him

  39. “Constrained Animation of Flocks” Matt Anderson, Eric McDaniel, and Stephen Chenney, 2003

  40. “Constrained Animation of Flocks” • The papers we have looked at so far focus on creating animations with minimal input from the animator • But in real applications, the animator usually wants to specify what happens in the scene!

  41. “Constrained Animation of Flocks” • Two-step model for constrained animation • Produce a trajectory that satisfies the constraints • Evaluate plausibility and refine the trajectory

  42. “Constrained Animation of Flocks” • Constraints • Point constraints: a character must be at a point at a certain time • Center-of-mass constraints: the center of mass of some group must be at a point at a certain time • Shape constraints: a group must lie inside a polygonal shape • Except for point constraints, these are not guaranteed to be satisfied – only approximated.

  43. “Constrained Animation of Flocks” • Behavior model • Based on Reynolds’ model • Each character gets a randomly sampled wander impulse at each timestep. • The wander contribution added to the character is a combination of this wander impulse and the normalized wander contribution from the previous timestep. ŵci-1: previous wander contribution (normalized) wii: current wander impulse wci: total wander contribution for this timestep

  44. “Constrained Animation of Flocks” • Finding initial trajectories • Find configurations that satisfy all the constraints, then interpolate trajectories in the “windows” between them • Possible methods (some or all of these may be used): • Forward simulation • Path transformation • Backward simulation

  45. “Constrained Animation of Flocks” • Finding initial trajectories • Forward simulation • Used when initial conditions are given for a window • Position characters to meet initial conditions, then run an unconstrained simulation using the behavior model

  46. “Constrained Animation of Flocks” • Finding Initial Trajectories • Path Transformation • Used when the window is part of a sequence of point or COM constraints • Fit a B-spline curve through the sequence of points • Run a forward simulation, and at each timestep, move the character onto the curve

  47. “Constrained Animation of Flocks” • Finding Initial Trajectories • Backward Simulation • Used when end constraints are given for the window • Position characters to meet end constraints, then run the simulation backwards (just reverse the birds’ perception) • Blend the resulting trajectory (xbackward) with the forward simulation (xforward) using a weighting function:

  48. “Constrained Animation of Flocks” • Evaluating plausibility of an animation • Determine whether the wander impulses are plausibly distributed (gw) • Determine how well the animation satisfies the COM and shape constraints (gc, gs) • Bias the animation toward producing a single flock (gf) • The overall plausibility function:

  49. “Constrained Animation of Flocks” • Evaluating the wander impulses • From the given trajectories, we can deduce the wander impulse of each character at each timestep • gw evaluates whether the wander impulses look like they were sampled from the right distribution • In this model, the wander impulses had uniformly random direction and normally distributed length, so we evaluate how well the lengths |wii| fit a normal distribution:

  50. “Constrained Animation of Flocks” • Evaluating constraint enforcement • Center of mass constraints: • COM(A, t) is the center of mass of the group at time t • Cx is the center of mass defined in the constraint • Shape constraints: • cs is a user-defined constant • dist(S, A, t) calculates the sum-of-squares distance of each character from the shape

More Related