1 / 79

Physics for Games Programmers Problem Overview

Physics for Games Programmers Problem Overview. Squirrel Eiserloh Technical Director Ritual Entertainment squirrel@eiserloh.net www.ritual.com www.algds.org. Types of Problems. Knowing when to cheat Simplifying things Giving shape to things Moving things around Simulation baggage

lali
Download Presentation

Physics for Games Programmers Problem Overview

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. Physics for Games Programmers Problem Overview Squirrel EiserlohTechnical DirectorRitual Entertainmentsquirrel@eiserloh.netwww.ritual.comwww.algds.org

  2. Types of Problems • Knowing when to cheat • Simplifying things • Giving shape to things • Moving things around • Simulation baggage • Detecting (and resolving) collisions • Sustained interactions • Dealing with the impossible • Making it fast enough

  3. Knowing When To Cheat

  4. Knowing When to Cheat • Discrete physics simulation falls embarrassingly short of reality. • “Real” physics is prohibitively expensive... • ...so we cheat. • We need to cheat enough to be able to run in real time. • We need to not cheat so much that things break in a jarring and unrecoverable way. • Much of the challenge is knowing how and when to cheat.

  5. Knowing When to Cheat • Ask: • “Will the player notice?” • “Will the player care?” • “Will the results be predictable?” • “Are we at least cheating in a consistent way?” • “Will the simulation break?” • If the simulation breaks, they will notice and they will care • Some crimes are greater than others

  6. Simplifying Things

  7. Simplifying Things • Simplified bodies

  8. Simplifying Things • Simplified bodies • Even more simplified bodies

  9. Simplifying Things • Simplified bodies • Even more simplified bodies • Convex bodies

  10. Simplifying Things • Simplified bodies • Even more simplified bodies • Convex bodies • Homogeneous bodies

  11. Simplifying Things • Simplified bodies • Even more simplified bodies • Convex bodies • Homogeneous bodies • Rigid bodies

  12. Simplifying Things • Simplified bodies • Even more simplified bodies • Convex bodies • Homogeneous bodies • Rigid bodies • Indestructible bodies

  13. Simplifying Things • Movement is often assumed to be in a vacuum (ignoring air resistance) • Even when air resistance does get simulated, it is hugely oversimplified

  14. Simplifying Things • Collisions are often assumed to be perfect and elastic • That is, 100% of the energy before the collision is maintained after the collision • Think billiard balls

  15. Giving Shape to Things

  16. Giving Shape to Things • N-sphere • 2d: Disc • 3d: Sphere

  17. Giving Shape to Things • N-sphere • 2d: Disc • 3d: Sphere • Simplex • 2d: Triangle • 3d: Tetrahedron

  18. Giving Shape to Things • N-sphere • 2d: Disc • 3d: Sphere • Simplex • 2d: Triangle • 3d: Tetrahedron • Convex Polytope • 2d: Convex Polygon • 3d: Convex Polyhedron • a.k.a. “Convex Hull” • a.k.a. “Brush” (Quake)

  19. Giving Shape to Things • Discrete Oriented Polytope (DOP)

  20. Giving Shape to Things • Discrete Oriented Polytope (DOP) • Oriented Bounding Box (OBB)

  21. Giving Shape to Things • Discrete Oriented Polytope (DOP) • Oriented Bounding Box (OBB) • Axis-Aligned Bounding Box (AABB)

  22. Giving Shape to Things • Discrete Oriented Polytope (DOP) • Oriented Bounding Box (OBB) • Axis-Aligned Bounding Box (AABB) • Capsule

  23. Giving Shape to Things • Discrete Oriented Polytope (DOP) • Oriented Bounding Box (OBB) • Axis-Aligned Bounding Box (AABB) • Capsule • Cylinder (3d only)

  24. Moving Things Around

  25. Moving Things Around • Kinematics • Describes motion • Uses position, velocity, momentum, acceleration

  26. Moving Things Around • Kinematics • Describes motion • Uses position, velocity, momentum, acceleration • Dynamics • Explains motion • Uses forces • ...and impulses

  27. Moving Things Around • Kinematics • Describes motion • Uses position, velocity, momentum, acceleration • Dynamics • Explains motion • Forces (F=ma) • Impulses • Rotation • Torque • Angular momentum • Moment of inertia

  28. Simulation Baggage

  29. Simulation Baggage • Flipbook syndrome

  30. Simulation Baggage • Flipbook syndrome • Things can happen in-between snapshots

  31. Simulation Baggage • Flipbook syndrome • Things mostly happen in-between snapshots

  32. Simulation Baggage • Flipbook syndrome • Things mostly happen in-between snapshots • Curved trajectories treated as piecewise linear

  33. Simulation Baggage • Flipbook syndrome • Things mostly happen in-between snapshots • Curved trajectories treated as piecewise linear • Terms often assumed to be constant throughout the frame

  34. Simulation Baggage (cont’d) • Error accumulates

  35. Simulation Baggage (cont’d) • Error accumulates • Energy is not always conserved • Energy loss can be undesirable • Energy gain is evil • Simulations explode!

  36. Simulation Baggage (cont’d) • Error accumulates • Energy is not always conserved • Energy loss can be undesirable • Energy gain is evil • Simulations explode! • Rotations are often assumed to happen instantaneously at frame boundaries

  37. Simulation Baggage (cont’d) • Error accumulates • Energy is not always conserved • Energy loss can be undesirable • Energy gain is evil • Simulations explode! • Rotations are often assumed to happen instantaneously at frame boundaries • Numerical nightmares!

  38. Collision Detection

  39. Collision Detection • We need to determine if A and B intersect

  40. Collision Detection • We need to determine if A and B intersect • Worse yet, they could be (and probably are) in motion

  41. Collision Detection • We need to determine if A and B intersect • Worse yet, they could be (and probably are) in motion • If they did collide, we probably also need to know when they collided

  42. Collision Response • ...and we need to figure out how to resolve the collision

  43. Sustained Interactions

  44. Sustained Interactions • Surface contact

  45. Sustained Interactions • Surface contact • Edge contact

  46. Sustained Interactions • Surface contact • Edge contact • Contact points

  47. Sustained Interactions • Surface contact • Edge contact • Contact points • Different solutions

  48. Sustained Interactions • Surface contact • Edge contact • Contact points • Different solutions • Stacking

  49. Sustained Interactions • Surface contact • Edge contact • Contact points • Different solutions • Stacking • Friction • Static & Kinetic

  50. Sustained Interactions • Surface contact • Edge contact • Contact points • Different solutions • Stacking • Friction • Static & Kinetic • Constraints & Joints

More Related