Skip to main content
gamedev.net
🔒 Locked

Steps to make a Physic engine

Started by q2guy Feb 25, 2004 at 4:56 PM 6 replies 1.5k views
Original Post
q2guy
q2guy
Which are the steps to make a physic engine, or a simple physic simulation ? 1. Make a complete math library (Vector,Matrix,Trig ...) 2. Select Integration method 3. Design/select timming of simulation 4. Collision detection (Box,Sphere,Capsule) ... n. Advanced features: Ragdoll, cloth, fluids, soft bodies ... I believe that my list is incomplete. Thanks [edited by - q2guy on February 25, 2004 6:10:15 PM]
MrRowl
MrRowl
You missed out

-3. read as much as you can find - baraff papers, hecker web site, lots of stuff around. Look for old/recent posts here and at flipcode.

-2. Have a nose around and see what other physics engines do - ODE, tokamak, 3impulse, novodex, havok etc... They may be closed source, but you can work stuff out by watching them, seeing what their bugs are, looking at their API/documentation etc!

-1. Write some really basic stuff - e.g. a little tech demo with bouncing, frictionless spheres. Exeperiment, and start to build up a set of maths classes (vector, matrix), and maybe a simple framework you can use to quickly knock together test programs. Start small so you have something to show for it - that will keep your enthusiasm going.

0. Decide what you want to achieve in your physics engine. Rather than writing a generic engine I'd develop it alongside some sort of application (e.g. something with cars/aeroplanes). That will limit the features, and also give you something to base your decision on - e.g. the collision primitives, do you need to support jointed bodies, stacking etc.

Basically once you've done some experimental coding and also decided exactly what you want to achieve, the (or at least a) path will become clear... If you don't sort these two things out, you'll flounder around and won't ever get anything done - Good luck!

[edited by - MrRowl on February 25, 2004 6:54:22 PM]
jimmynelson
jimmynelson
just commenting on rowl''s excellent response and very cool looking physics engine off his website... I will be reading that article you have posted on your WIP page tonight... great job!

VThornheart
VThornheart
Hmm, I''m interested in hearing about the implications of integration... are you referring to mathematical integration? Or integration as in "how will I integrate physics into my engine?" Just looking for clarification, as I''m trying to create a 2-D physics engine and thus am curious about these things. =)
-Vendal Thornheart=) Programming for a better tomorrow... well,for a better simulated tomorrow. ;)
Kuladus
Kuladus
quote:
Original post by VThornheart
Hmm, I''m interested in hearing about the implications of integration... are you referring to mathematical integration? Or integration as in "how will I integrate physics into my engine?" Just looking for clarification, as I''m trying to create a 2-D physics engine and thus am curious about these things. =)


I think he meant the method of integration of a, v and x.

Yes I am also kind of struggling with the integration of the physics engine into my game- my solution ended up being quite obvious... have a physics object, have a graphics object etc... then have a main object (like a character) that subclasses both of these. I have had trouble finding good tutorials on the integration of various components of a game, maybe I will write one when I finish.
VThornheart
VThornheart
Aye, I for one would find that VERY useful. Some things feel like they fit into objects well, and are easy to integrate and represent via objects... some things feel much more awkward though, and Physics is one of them. Do I give my objects a "physics"? Should they perhaps refer to some universal "Physics" object? Should bounding boxes be members of the Physics object (if there should even be one), or of the drawn object? So many questions. =) Tutorials on how people tend to do it would be quite useful to see indeed. =)
-Vendal Thornheart=) Programming for a better tomorrow... well,for a better simulated tomorrow. ;)
PyroSA
PyroSA
I get the feeling he means integration as in method of solving integrals, not integration as in putting the stuff together ...

Still, good luck on the whole task of the physics thing, it''s one whole lot of work. Good luck.
q2guy
q2guy
I talk about mathematical integration method, although integration with a graphical engine is very interesting too.
Thanks a lot for your responses!

[edited by - q2guy on March 2, 2004 7:15:00 PM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.