Beruflich Dokumente
Kultur Dokumente
Problem Overview
Squirrel Eiserloh
MumboJumbo Games
squirrel@eiserloh.net www.algds.org Technical Director
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
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
Simplifying Things
Simplifying Things
Simplified bodies
Simplifying Things
Simplifying Things
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
14
Simplifying Things
15
Simplifying Things
That is, 100% of the energy before the collision is maintained after the collision
Think billiard balls
16
17
N-sphere
18
N-sphere
Simplex
19
N-sphere
Simplex
Convex Polytope
20
21
22
Discrete Oriented Polytope (DOP) Oriented Bounding Box (OBB) Axis-Aligned Bounding Box (AABB)
23
Discrete Oriented Polytope (DOP) Oriented Bounding Box (OBB) Axis-Aligned Bounding Box (AABB) Capsule
24
Discrete Oriented Polytope (DOP) Oriented Bounding Box (OBB) Axis-Aligned Bounding Box (AABB) Capsule Cylinder (3d only)
25
26
Kinematics
Describes motion
Uses position, velocity, momentum, acceleration
27
Kinematics
Describes motion
Uses position, velocity, momentum, acceleration
Dynamics
Explains motion
Uses forces ...and impulses
28
Kinematics
Describes motion
Uses position, velocity, momentum, acceleration
Dynamics
Explains motion
Forces (F=ma) Impulses Torque Angular momentum Moment of inertia
Rotation
29
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator
30
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator
31
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator
32
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator
33
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator
34
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator Which integration method to use?
35
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator Which integration method to use?
36
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator Which integration method to use?
37
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator Which integration method to use?
38
How to compute the next position and velocity from current position and velocity? This process is called integration; An algorithm for doing this in an integrator Which integration method to use?
39
Simulation Baggage
40
Simulation Baggage
Flipbook syndrome
41
Simulation Baggage
42
Simulation Baggage
43
Simulation Baggage
Flipbook syndrome Things mostly happen in-between snapshots Curved trajectories treated as piecewise linear
44
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
45
Simulation Baggage
(contd)
Error accumulates
46
Simulation Baggage
(contd)
Simulations explode!
47
Simulation Baggage
(contd)
Simulations explode!
48
Simulation Baggage
(contd)
Simulations explode!
Rotations are often assumed to happen instantaneously at frame boundaries Numerical nightmares!
49
Collision Detection
50
Collision Detection
51
Collision Detection
We need to determine if A and B intersect Worse yet, they could be (and probably are) in motion
52
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
53
Collision Response
54
Sustained Interactions
55
Sustained Interactions
Surface contact
56
Sustained Interactions
57
Sustained Interactions
Different solutions
58
Sustained Interactions
Different solutions
59
Sustained Interactions
Different solutions
Stacking
60
Sustained Interactions
Different solutions
Stacking Friction
61
Sustained Interactions
Different solutions
Stacking Friction
62
63
Interpenetration
64
Interpenetration Tunneling
65
Interpenetration Tunneling
66
Interpenetration Tunneling
67
Interpenetration Tunneling
68
Tunneling
(Sucks)
69
Tunneling
70
Tunneling
(contd)
Possible solutions
71
Tunneling
(contd)
72
Tunneling
(contd)
Possible solutions
Inadequate; fast objects still tunnel Inadequate; since speed limit is a function of object size, this would mean small & fast objects (bullets) would not be allowed Helpful, but inadequate; this is essentially the same as a speed limit
73
Tunneling
(contd)
Besides, even with min. size requirements and speed limits and a small timestep, you still have degenerate cases that cause tunneling!
74
Tunneling
(contd)
Besides, even with min. size requirements and speed limits and a small timestep, you still have degenerate cases that cause tunneling!
75
Tunneling
(contd)
Besides, even with min. size requirements and speed limits and a small timestep, you still have degenerate cases that cause tunneling!
76
Tunneling
(contd)
Besides, even with min. size requirements and speed limits and a small timestep, you still have degenerate cases that cause tunneling!
77
Tunneling
(contd)
78
Tunneling
(contd)
79
80
81
82
Avoid the everything vs. everything case Try using simulation islands and space partitioning to divide and conquer
83
Simulation Islands
Consider:
84
Simulation Islands
Consider:
1000 objects, 1 island 1000x1000 checks = 1 Million checks 1000 objects, divided into 10 islands of 100 10 x (100x100) checks = 100,000 checks 1/10th as many!
Verses:
85
Simulation Islands
86
Simulation Islands
87
Simulation Islands
88
Simulation Islands
89
Simulation Islands
90
Simulation Islands
91
Simulation Islands
Add the newcomer to this simulation island ...and put it back to sleep once it stabilizes
This is just one of many ways to reduce complexity Well be covering several others later on
92
to have changed a whole lot in the 15ms or so since the previous frame, so save the previous frames results! Spatial coherence: Things tend to miss each other far more often than they collide, and only things in the same neighborhood can collide with each other
93
Summary
94
Summary
The nature of simulation causes us real problems... problems which cant be ignored So we cheat And we simplify things And even then, it can get quite complex...
95
Summary
(contd)
96
Questions?
squirrel@eiserloh.net