1 / 29

Artificial Intelligence ( for games ) Chapter 3: Movement

Artificial Intelligence ( for games ) Chapter 3: Movement. Universität zu Köln Historisch Kulturwissenschaftliche Informationsverarbeitung WS 12/13 Übung: Visuelle Programmierung I – Simulation und 3D Programmierung Prof. Dr. Manfred Thaller Referent: Jan Moritz Kohl. Die Basics.

gage-myers
Download Presentation

Artificial Intelligence ( for games ) Chapter 3: Movement

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. ArtificialIntelligence (forgames)Chapter 3: Movement Universität zu Köln Historisch Kulturwissenschaftliche Informationsverarbeitung WS 12/13 Übung: Visuelle Programmierung I – Simulation und 3D Programmierung Prof. Dr. Manfred Thaller Referent: Jan Moritz Kohl

  2. Die Basics • Kinematisch • Input: position (character + target) + orientation • output: direction + velocity • Dynamisch „Steeringbehaviors“ • input:velocity + position, • outpout:forces + accelerations • flocking

  3. Mathematik

  4. Independent Facing # update position and orientation # and the velocity and rotation position += velocity * time velocity += steering.linear * time orientation += rotation * time rotation += steering.angular * time

  5. Kräfte und Antrieb • Kraft führt zu Änderung der kinetischen Energie • Beschleunigung abhängig von Trägheit • steering algorithmen haben Beschleunigung als output -> post-processing: actuation (Antrieb)

  6. Kinematische Bewegung (Seek) voidKinematicSeek::getSteering(SteeringOutput* output) const { // First work out thedirection output->linear = *target; output->linear -= character->position; // Ifthereisnodirection, do nothing if(output->linear.squareMagnitude() > 0) { output->linear.normalise(); output->linear *= maxSpeed; } }

  7. Kinematische Bewegung (Flee) voidKinematicSeek::getSteering(SteeringOutput* output) const { // First work out the direction output->linear = character->position; output->linear -= *target; // If there is no direction, do nothing if (output->linear.squareMagnitude() > 0) { output->linear.normalise(); output->linear *= maxSpeed; } }

  8. Kinematische Bewegung (Arriving) voidKinematicArrive::getSteering(SteeringOutput* output) const { // First work out thedirection output->linear = *target; output->linear -= character->position; // Ifthereisnodirection, do nothing if(output->linear.squareMagnitude() < radius*radius) { output->linear.clear(); } else { // We'dliketoarrive in timeToTargetseconds output->linear *= ((real)1.0 / timeToTarget); // Ifthatistoo fast, thenclipthespeed if (output->linear.squareMagnitude() > maxSpeed*maxSpeed) { output->linear.normalise(); output->linear *= maxSpeed; } } }

  9. Kinematische Bewegung (Wandering) • Bewegung erfolgt sukzessiv (schlendern) • randomBinomial() funktion liefert Wert zwischen -1 und 1 Werte um 0 sind wahrscheinlicher

  10. Steering Behaviors • Speed ist jetzt acceleration • Problem: Orbit • Lösung: target Radius slow Radius

  11. Steering (Align) radian(-,)

  12. DelegatedBehaviors: PursueandEvade Face Lookingwhereyou‘regoing Wander Path Following Separation Collision

  13. Pursue and Evade ifspeed <= distance /maxPrediction: prediction:maxPrediction

  14. Face / Looking where you‘re going • Delegation der Alignmethode • Character schaut nicht zwingend in die Richtung des target #Check for a zerodirection, andmakenochangeif so ifcharacter.velocity.length() == 0: return #Otherwisesetthetargetbased on thevelocity target.orientation = atan2(-character.velocity.x, character.velocity.z) #2. Delegatetoalign returnAlign.getSteering()

  15. Wander • Zielloses umherwandern • delegated face behavior

  16. Path Following • „Chase the rabbit“

  17. Limit the getParam algorithm: kohärenz

  18. Separation • Linear separation: strength = maxAcceleration * (threshold – distance) / threshold • Inverse squarelaw(Abstandsgesetz): strenght = min(k / (distance * distance), maxAcceleration) „repulsionsteering“

  19. Collision Avoidance

  20. Obstacle and Wall Avoidance

  21. The Corner Trap

  22. Source Code und Demo unter: www.ai4g.com Millington, Ian/Funge, John: Artificial Intelligence. For Games.Burlington, Massachusetts 2009.

More Related