1 / 117

CSCE 590E Spring 2007

This article discusses various motion extraction and animation techniques for game instances, including linear motion extraction, composite motion extraction, variable delta extraction, and animation without rendering.

toothman
Download Presentation

CSCE 590E Spring 2007

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. CSCE 590E Spring 2007 AI By Jijun Tang

  2. Announcements • April 16th/18th: demos • Show progress/difficulties/change of plans • USC Times will have reporters in the class • High school outreach • Anyone can contact their high school admin to arrange direct talks to students • Of course, in SC only

  3. Homework • P 655 questions 1 and 2 • 5 points total • Due April 16th

  4. Motion Extraction • Moving the Game Instance • Linear Motion Extraction • Composite Motion Extraction • Variable Delta Extraction • The Synthetic Root Bone • Animation Without Rendering

  5. Moving the Game Instance • Game instance is where the game thinks the object (character) is • Usually just • pos, orientation and bounding box • Used for everything except rendering • Collision detection • Movement • It’s what the game is! • Must move according to animations

  6. Linear Motion Extraction • Find position on last frame of animation • Subtract position on first frame of animation • Divide by duration • Subtract this motion from animation frames • During animation playback, add this delta velocity to instance position • Animation is preserved and instance moves • Do same for orientation

  7. Composite Motion Extraction • Approximates motion with circular arc • Pre-processing algorithm finds: • Axis of rotation (vector) • Speed of rotation (radians/sec) • Linear speed along arc (metres/sec) • Speed along axis of rotation (metres/sec) • e.g. walking up a spiral staircase

  8. Variable Delta Extraction • Uses root bone motion directly • Sample root bone motion each frame • Find delta from last frame • Apply to instance pos+orn • Root bone is ignored when rendering • Instance pos+orn is the root bone

  9. The Synthetic Root Bone • All three methods use the root bone • But what is the root bone? • Where the character “thinks” they are • Defined by animators and coders • Does not match any physical bone • Can be animated completely independently • Therefore, “synthetic root bone” or SRB

  10. Animation Without Rendering • Not all objects in the world are visible • But all must move according to anims • Make sure motion extraction and replay is independent of rendering • Must run on all objects at all times • Needs to be cheap! • Use LME & CME when possible • VDA when needed for complex animations

  11. Mesh Deformation • Find Bones in World Space • Find Delta from Rest Pose • Deform Vertex Positions • Deform Vertex Normals

  12. Example

  13. Find Delta from Rest Pose • Mesh is created in a pose • Often the “da Vinci man” pose for humans • Called the “rest pose” • Must un-transform by that pose first • Then transform by new pose • Multiply new pose transforms by inverse of rest pose transforms • Inverse of rest pose calculated at mesh load time • Gives “delta” transform for each bone

  14. Deform Vertex Positions • Each vertex has several bones affect it (the number is generally set to <=4). • Vertices each have n bones • n is usually 4 • 4 bone indices • 4 bone weights 0-1 • Weights must sum to 1 • Deformation usually performed on GPU • Delta transforms fed to GPU • Usually stored in “constant” space

  15. Deform Vertex Normals • Normals are important for shading and are done similarly to positions • When transformed, normals must be transformed by the inverse transpose of the transform matrix • Translations are ignored • For pure rotations, inverse(A)=transpose(A) • So inverse(transpose(A)) = A • For scale or shear, they are different • Normals can use fewer bones per vertex • Just one or two is common

  16. Inverse Kinematics • FK & IK • Single Bone IK • Multi-Bone IK • Cyclic Coordinate Descent • Two-Bone IK • IK by Interpolation

  17. Single Bone IK • Orient a bone in given direction • Eyeballs • Cameras • Find desired aim vector • Find current aim vector • Find rotation from one to the other • Cross-product gives axis • Dot-product gives angle • Transform object by that rotation

  18. Multi-Bone IK • One bone must get to a target position • Bone is called the “end effector” • Can move some or all of its parents • May be told which it should move first • Move elbow before moving shoulders • May be given joint constraints • Cannot bend elbow backwards

  19. Two-Bone IK • Direct method, not iterative • Always finds correct solution • If one exists • Allows simple constraints • Knees, elbows • Restricted to two rigid bones with a rotation joint between them • Knees, elbows! • Can be used in a cyclic coordinate descent

  20. IK by Interpolation • Animator supplies multiple poses • Each pose has a reference direction • e.g. direction of aim of gun • Game has a direction to aim in • Blend poses together to achieve it • Source poses can be realistic • As long as interpolation makes sense • Result looks far better than algorithmic IK with simple joint limits

  21. Network and Multiplayer

  22. Multiplayer Modes:Event Timing • Turn-Based • Easy to implement • Any connection type • Real-Time • Difficult to implement • Latency sensitive

  23. Protocol Stack: Open System Interconnect

  24. Real-Time Communications:Peer to Peer vs. Client/Server N = Number of players

  25. Security:Encryption Methods • Keyed • Public Key • Private Key • Ciphers • Message Digest • Certificates • IPSec

  26. Security:Copy Protection • Disk Copy Protection • Costly Mastering, delay copies to ensure first several months’ sale • Invalid/Special Sector Read • Code Sheets • Ask code from a line in a large manual • Watermarking

  27. Privacy • Critical data should be kept secret and strong encrypted: • Real name • Password • Address/phone/email • Billing • Age (especially for minors) • Using public key for transforming user name and password

  28. Artificial Intelligence:Agents, Architecture, and Techniques

  29. Book Material • The book CD has a lot of material in the chapter content • A state machine language for example • Please try it

  30. Artificial Intelligence • Intelligence embodied in a man-made device • Human level AI still unobtainable • The difficulty is comprehension

  31. Game Artificial Intelligence:What is considered Game AI? • Is it any NPC (non-player character) behavior? • A single “if” statement? • Scripted behavior? • Pathfinding? • Animation selection? • Automatically generated environment? • Best shot at a definition of game AI?

  32. Possible Game AIDefinition Inclusive view of game AI: “Game AI is anything that contributes to the perceived intelligence of an entity, regardless of what’s under the hood.”

  33. Goals of anAI Game Programmer Different than academic or defense industry 1. AI must be intelligent, yet purposely flawed 2. AI must have no unintended weaknesses 3. AI must perform within the constraints 4. AI must be configurable by game designers or players 5. AI must not keep the game from shipping

  34. Specialization ofGame AI Developer • No one-size fits all solution to game AI • Results in dramatic specialization • Strategy Games • Battlefield analysis • Long term planning and strategy • First-Person Shooter Games • One-on-one tactical analysis • Intelligent movement at footstep level • Real-Time Strategy games the most demanding, with as many as three full-time AI game programmers

  35. Game Agents • May act as an • Opponent • Ally • Neutral character • Continually loops through the Sense-Think-Act cycle • Optional learning or remembering step

  36. Sense-Think-Act Cycle:Sensing • Agent can have access to perfect information of the game world • May be expensive/difficult to tease out useful info • Game World Information • Complete terrain layout • Location and state of every game object • Location and state of player • But isn’t this cheating???

  37. Sensing:Enforcing Limitations • Human limitations? • Limitations such as • Not knowing about unexplored areas • Not seeing through walls • Not knowing location or state of player • Can only know about things seen, heard, or told about • Must create a sensing model

  38. Sensing:Human Vision Model for Agents • Get a list of all objects or agents; for each: 1. Is it within the viewing distance of the agent? • How far can the agent see? • What does the code look like? 2. Is it within the viewing angle of the agent? • What is the agent’s viewing angle? • What does the code look like? 3. Is it unobscured by the environment? • Most expensive test, so it is purposely last • What does the code look like?

  39. Sensing:Vision Model • Isn’t vision more than just detecting the existence of objects? • What about recognizing interesting terrain features? • What would be interesting to an agent?

  40. Sensing:Human Hearing Model • Humans can hear sounds • Can recognize sounds • Knows what emits each sound • Can sense volume • Indicates distance of sound • Can sense pitch • Sounds muffled through walls have more bass • Can sense location • Where sound is coming from

  41. Sensing:Modeling Hearing • How do you model hearing efficiently? • Do you model how sounds reflect off every surface? • How should an agent know about sounds?

  42. Sensing:Modeling Hearing Efficiently • Event-based approach • When sound is emitted, it alerts interested agents • Use distance and zones to determine how far sound can travel

  43. Sensing:Communication • Agents might talk amongst themselves! • Guards might alert other guards • Agents witness player location and spread the word • Model sensed knowledge through communication • Event-driven when agents within vicinity of each other

  44. Sensing:Reaction Times • Agents shouldn’t see, hear, communicate instantaneously • Players notice! • Build in artificial reaction times • Vision: ¼ to ½ second • Hearing: ¼ to ½ second • Communication: > 2 seconds

  45. Sense-Think-Act Cycle: Thinking • Sensed information gathered • Must process sensed information • Two primary methods • Process using pre-coded expert knowledge • Use search to find an optimal solution

  46. Thinking:Expert Knowledge • Many different systems • Finite-state machines • Production systems • Decision trees • Logical inference • Encoding expert knowledge is appealing because it’s relatively easy • Can ask just the right questions • As simple as if-then statements • Problems with expert knowledge • Not very scalable

  47. Finite-state machine (FSM)

  48. Production systems • Consists primarily of a set of rules about behavior • Productions consist of two parts: a sensory precondition (or "IF" statement) and an action (or "THEN") • A production system also contains a database about current state and knowledge, as well as a rule interpreter

  49. Decision trees

More Related