What to study in prep for writing a physics engine?

Please don't post Bullet support questions here, use the above forums instead.
User avatar
InvisibleMan
Posts: 2
Joined: Tue Jun 14, 2011 2:07 pm

What to study in prep for writing a physics engine?

Post by InvisibleMan »

I'm planning on going through the resources Chris Hecker recommends in his article Physics References, however that article (from what I gather) was written in around 1997: 14 years ago.

I suspect that there have been new developments since the article was put together, which brings us to the reason for this post: Do you guys have any additions/changes to the list he gives? For example, changing the order in which a topic is studied, a new and better book for a particular topic in the list, new topics to add to the study list (with accompanying book recommendations if you can), etc.

I like the fact that he discusses each set of books and the pros/cons. If you guys could provide similar notes with your recommendations, as well as when I should study that topic (right after reading the Calculus book? After reading everything else in that list?) and what I will be able to do in my physics engine after I study it (like his "milestones"), it would really help :)

To help you decide what recommendations to make, I'll do my best to describe where I am in math. I should note though that I am currently planning on going through each resource in that list (with exceptions to duplicates), including topics I am familiar with. The main reason for this (as you will probably see in the following) is that while I might know overall about a particular topic, I usually don't have a whole lot of experience mainly due to not studying from a textbook with problem sets.

Basic math
  • Addition, subtraction, multiplication, division, fractions...
Algebra I
  • I learned this from a textbox, but unfortunately I do not have the title available to me at the moment.
Geometry Algebra II
  • I never studied this from a textbook, but I did pickup on parts of it by studying other areas of math and programming. Using this page as a reference for what is studied in Algebra II, I am familiar with the following:
    • Solving Equations and Inequalities - I don't have much experience with inequalities, but I know how to work with them.
    • Graphs and Functions
    • Systems of Equations and Inequalities - I don't have much experience with solving systems, but I know the gist of it.
    • Polynomials and Factoring - I don't have much experience with polynomials (I can't recite from memory the various methods of dealing with them), but I do know what they are and I am familiar with how to work with them.
    • Fractional Expressions
    • Powers and Roots
    • Complex Numbers - I know what these are basically, but I have very close to zero experience with them.
    • Quadratic Equations - Most of my experience with solving these is by using the quadratic formula (which I have derived for myself several times before, once by accident).
    • Quadratic Functions - Most of my experience with these is from learning Calculus.
    • Coordinate Geometry - I'm familiar with this, but I usually need to use a reference whenever I have need of it.
    • Exponential and Logarithmic Functions - I get the terms "exponential function" and "power function" mixed up regularly, and I require references when working with logarithms (particularly natural log).
    • Probability - As far as I know, I don't have direct experience or knowledge of this.
Trigonometry
  • I never studied this formally, but I picked up on parts of it from studying other things and programming. Using this page as a reference for what is studied, this is what I know:
    • Angle measurement
    • Chords - I am familiar with the term, but I don't have much experience or knowledge of the thing itself.
    • Sines
    • Cosines
    • Tangents and slope - I am familiar with this only through studying Calculus.
    • The trigonometry of right triangles - I know how to use the inverse functions, but I am not all that familiar with the rest.
    • The trigonometric functions and their inverses - I'm not very familiar with the properties of sines and cosines, although I have looked them up and made use of them in the past.
    • Computing trigonometric functions - As far as I know, I have no knowledge of this.
    • The trigonometry of oblique triangles - I'm not familiar with the law of sines or cosines.
    • Area of a triangle - I am familiar with a = bh/2 but not the method they describe in this section.
    • Summary of trigonometric identities - I am familiar with SOH-CAH-TOA, but my situation with the trigonometric identities is the same as my situation with the properties.
Calculus Multivariable Calculus
  • I learned this by watching the 18.02 lectures at MIT OpenCourseWare. I made sure I understood each lecture by pausing and rewatching, but I did not do any of the homework assignments or exams, and I did not have the textbook.
Differential Equations
  • I learned this by watching the first 4-7 (I don't remember the exact lecture I stopped on) 18.03 lectures at MIT OpenCourseWare. I did not have the textbook, and I did not do the homework assignments or exams.
Linear Algebra Set Theory
  • I know the basics, mostly from an introduction I had in between basic math and algebra I, as well as from studying other things.
Graph Theory Topology Abstract Algebra Linear/Quadratic Programming and LCP
  • I know of their existence and a tiny bit about what they are as well as what they are used for in a physics engine. I do not have any experience with these or knowledge of how to work with them.
Physics Physics Simulation
  • I have read through most of the papers by David Baraff, although I did not completely understand them. I have also gone through various other papers including "Nonconvex Rigid Bodies with Stacking" and "A Unified Framework for Rigid Body Dynamics", the latter being the most helpful. I have also gone through Erin Catto's GDC2006 slides and the source for Box2D Lite. I have glanced through some of the chapters in Game Physics 2nd Edition by David H. Eberly, as well as Chris Hecker's Game Developer Magazine columns sans the one on 3D physics. I have also written several physics engines, however they have not worked very well.
Collision Detection
Johan Gidlund
Posts: 26
Joined: Mon Jun 01, 2009 2:21 pm
Location: Sweden

Re: What to study in prep for writing a physics engine?

Post by Johan Gidlund »

The math you need to know to write a physics engine has not changed in some time so what was valid in 1997 is probably still valid.

What has changed are the actual algorithms that are used for the different stages on the simulation.
Christers book should give a pretty good overview of what is typically used today and there is also a similar book by Gino van der Bergen.

I personally don't believe in just learning all the theory first.
You need to put your knowledge to use to find you what you need to learn more about.
Read through Christers and Ginos book and if you find math that you don't understand you probably need to study that topic more.
Even better is to try and write a small simple physics simulation including broadphase and narrowphase collision detection as well as a solver. I did this during my university years and it was very enlightening.

Finally, you don't really need exceptional math knowledge to write a physics engine based on existing algorithms.
If you really want to understand things on a level where you can start to come up with new better algorithms or clever new implementations you need to _really_ understand the theory. Not just on the level you have after taking some class at uni, you need to put it to real usage. I personally find that a good test for when you really understand a subject well enough is if you can explain it to someone else.
User avatar
InvisibleMan
Posts: 2
Joined: Tue Jun 14, 2011 2:07 pm

Re: What to study in prep for writing a physics engine?

Post by InvisibleMan »

Alright, thanks :)