Sign in to follow this  
Cubed3

Physical Simulations, Where to Start?

Recommended Posts

Ok heres my deal. Im working on the design of a 3D futuristic racing sim ala Wipeout/F-Zero. Im thinking about making a topdown 2D racer first then later on rewriting everything using Ogre3D/OpenGL and other assorted goodies. However Im kind of confused on how to do the physics for the game. I keep hearing things like constrained physics and non constrained. Verlat integrators and other such things. ODE, PhysX... Im confused!!! Where do I start!?!? My background in math/physics-> Im a 2nd year Mechanical Engineering student and my highest level of math is DiffEQ/Linear Algebra. My Highest level of Physics is Modern Physics(which is irrelevant mostly to this game) so I will say classical physics with calculus.

Share this post


Link to post
Share on other sites
1. Write a simple integrator (start with NSV; google this site) and drop a single particle (render on screen).
2. Make the particle bounce in different ways (control Coefficient of Restitution).
3. Write a simple pong game (bounce particle off walls, moving objects (paddles).
4. Play with Erin Catto's 2D physics demo (google this site).
5. If 3D, use ODE (you'll have a good idea what to do at this point), or extend ideas in Erin's 2D demo to 3D, or play with Danny Chapman's Jiggle/Jiglib Demo (google). Also google and see David Baraff's Physics Lectures/Notes and see Non-convex Rigid Bodies with Stacking paper.
6. If just a hobby/non-commercial project, using PhysX (Novodex+Meqon in software) would probably be the easiest/fastest way to get your game up and running (if commercial, will have to pay a license fee). If Havok (most mature system/API) offered a student/budget license, that would also be a good way to go.

Share this post


Link to post
Share on other sites
Quote:
Original post by John Schultz
1. Write a simple integrator (start with NSV; google this site) and drop a single particle (render on screen).
2. Make the particle bounce in different ways (control Coefficient of Restitution).
3. Write a simple pong game (bounce particle off walls, moving objects (paddles).
4. Play with Erin Catto's 2D physics demo (google this site).
5. If 3D, use ODE (you'll have a good idea what to do at this point), or extend ideas in Erin's 2D demo to 3D, or play with Danny Chapman's Jiggle/Jiglib Demo (google). Also google and see David Baraff's Physics Lectures/Notes and see Non-convex Rigid Bodies with Stacking paper.
6. If just a hobby/non-commercial project, using PhysX (Novodex+Meqon in software) would probably be the easiest/fastest way to get your game up and running (if commercial, will have to pay a license fee). If Havok (most mature system/API) offered a student/budget license, that would also be a good way to go.

Could you please show me some info about 1. and 2? It's not that I'm not good at Calculus/Math, it's just that my English is not as good as to understand what you've wrote at a first glance :P.

Regards,
José J. Enríquez.

Share this post


Link to post
Share on other sites
Quote:
Original post by GeoMX
Could you please show me some info about 1. and 2? It's not that I'm not good at Calculus/Math, it's just that my English is not as good as to understand what you've wrote at a first glance :P.


Basic integrator using NSV.

Physics Tutorials on GameDev.net.

[google] for more info: there's lot's of physics info out there (see also physics game books through Amazon.com).

Share this post


Link to post
Share on other sites
I think all I need is some reference to find out what are the "equivalent terms" in my language ;). (Well, at least I'll learn more English vocabulary :P). Thank you.

Regards,
José J. Enríquez.

Share this post


Link to post
Share on other sites
Im a bit confused on the NSV thing... I started writing my bouncing particles demo before I did any research and I used this method


pVel.x += pAccel.x * dt;
pVel.y += pAccel.y * dt;

pPos.x += pVel.x * dt;
pPos.y += pVel.y * dt;


Is that what the NSV basically is? For some reason I thought I was using Eulers method :/


For more accuracy, if I ever needed it, I was thinking of doing

dt2 = dt/2;
//Calculate velocity at midpoint
pVel.x += pAccel.x * dt2;
pVel.y += pAccel.y * dt2;
//Calculate position at midpoint
pPos.x +=pVel.x * dt2;
pPos.y += pVel.x*dt2;
//Calculate Velocity at the end
pVel.x += pAccel.x * dt2;
pVel.y += pAccel.y * dt2;
//Calculate Position at the end
pPos.x +=pVel.x * dt2;
pPos.y += pVel.x*dt2;

An extra 4 calculations to get twice the dt accuracy. At least thats what I think it would do.

Share this post


Link to post
Share on other sites
Quote:
Original post by Cubed3
Im a bit confused on the NSV thing... I started writing my bouncing particles demo before I did any research and I used this method


pVel.x += pAccel.x * dt;
pVel.y += pAccel.y * dt;

pPos.x += pVel.x * dt;
pPos.y += pVel.y * dt;


Is that what the NSV basically is? For some reason I thought I was using Eulers method :/


Makes intuitive sense, right? That's NSV. Explicit Euler reverses the order (update position first, then velocity).

While the ordering difference is trivial, the improvements are not (pretty amazing).

If you want to improve on the accuracy, see the Velocity Verlet example. Though for particles, more accuracy is not worth the CPU cost (perhaps useful if you have springs connecting the particles, etc.).

Share this post


Link to post
Share on other sites
Ahh That's good to know then.

The reverse order seems kind of wierd... Since the acceleration won't have any affect until the next timestep.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this