Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've recently started a project, building a physics engine. I was hoping you could give me some advice related to some documentation and/or best technologies for this.

First of all, I've seen that Game-Physics-Engine-Development is highly recommended for the task at hand, and I was wondering if you could give me a second opinion.Should I get it? Also, while browsing Amazon, I've stumbled onto Game Engine Architecture and since I want to build my physics engine for games, I thought this might be a good read aswell.

Second, I know that simulating physics is highly computation intensive so I would like to use either CUDA or OpenCL.Right now I'm leaning towards OpenCL, because it would work on both NVIDIA and ATI chipsets.What do you guys suggest?

PS: I will be implementing this in C++ on Linux.

share|improve this question

3 Answers 3

up vote 9 down vote accepted

Here is how I learned to write a physics engine, its all free and highly recommendable:

  1. David Baraff's papers particulary An Introduction to Physically Based Modeling

  2. Brian Vincent Mirtich's Thesis Impulse-based Dynamic Simulation of Rigid Body Systems

  3. Kacic/Bullock "A practical dynamics system" SIGRAPH 2003, EDIT: Link added.

Those papers were mentioned in another great article from Nick Porcino (LucasArts) in one of the gems-books Gems 4 "Writing a Verlet-Based Physics Engine". Its not free, but its worth every penny.

Also have a look at other engines, here is the source for the Bullet Physics Engine.

About the CUDA/OpenCL implementation: make it run on the CPU first, it's complicated enough :)

Be aware that most likely you will throw your engine away after a while, since its just too hard to make a stable and well integrated physics engine with a competitive feature-list on your own, however it's a great learning experience!

As soon as you have a simple engine running, my advice is: make test-scenarios where you compare the result of your engine with the result of another engine. This helped me find a lot of errors and it will improve your interface; something like appling a similar force for 1 second at the same body in both engines.

Last but not least: Ignore collisions when you start, focus on a stable simulation first.

share|improve this answer
    
Looks like a great answer, but you may want to format it a bit. –  The Communist Duck Apr 18 '11 at 8:38
    
Thanks for the feedback.I agree that I won't be able to make a competitive engine, but my main goal with this is the learning part. –  adivasile Apr 18 '11 at 9:14
1  
@The Communist Duck thanks for the hint, I was new to the side and I admit I was too lazy to check out the format options, fixed it :) –  Maik Semder Apr 18 '11 at 9:19
1  
Added the link to Kacic's paper, hopefully it's the right one :) –  Ray Dey Apr 18 '11 at 12:52
    
Thanks Ray, yes that's the one I meant :) –  Maik Semder Apr 18 '11 at 13:33

I started out with Baraff too but it's a bit dated by now. What you need is iterative solvers and the best paper imo on that is Erin Catto's Iterative Dyanmics. You have all you need in there to implement your physics engine. You can dig a bit into Erleben's PhD thesis if you need more details (like joints and more math stuff), but that's pretty much it. I wish I had found it from the start - go through the Bullet forum a bit, there's plenty information in there (maybe too much).

As for books many of the books out there are disappointing, but I do recommend Physics Based Animation by Kenny Erleben or Game Physics Pearls.

Don't know much CUDA/OpenCL (although I always wanted to do it) but you should definitely check out Takahiro Harada's work.

share|improve this answer

Maik is right, Baraff's papers are an excellent start, but don't forget Chris Heckers write-up on rigid body dynamics: http://chrishecker.com/Rigid_Body_Dynamics !

Also his advice on "[..] you will throw your engine away" is entirely true. But you will learn a lot!

Regarding the CUDA/OpenCL part of your question: If you know CUDA then switching to OpenCL becomes very easy. I'd recommend learning CUDA first, because there are so many good tutorials, example code and computation libraries out there. For example:

But be aware: Getting started on CUDA is easy, getting started on physics simulation is a good bit harder, but combining both is quite a challenge!

share|improve this answer
    
you're absolutely right, that's another great resource that must be mentioned, +1 for Chris Hecker's paper –  Maik Semder Apr 18 '11 at 13:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.