Handmade Hero»Forums»Code
Graham Rhodes
2 posts
minor point about aerodynamic drag force from ep41
I'd like to make a comment about a technical issue that is often (usually) insignificant from the point of view of game development. Having been an aerodynamicist in a past life I feel obligated to comment. Most of you should consider this post to be background noise, perfectly safe to ignore.

If you are particularly interested in physics, you may find this interesting. If you are trying to build a realistic flight or racing simulator, you really should pay attention to this! (But for an arcade style flight or racing game, probably ignore.)

During episode 41 while talking about ODE's and the integration of the fundamental equations of motion, Casey mentioned that the aerodynamic drag force is proportional to the opposite of the object's relative velocity through the air or a fluid/liquid. That linear relationship is an approximation that, while extremely common in game development due to its simplicity, is almost always quite inaccurate. (I said "inaccurate" rather than "bad" because "bad"/"good" depends on what you wish to accomplish with your game.) The linear relationship applies to objects or particles moving in what is known as Stokes flow, aka creeping flow. This occurs at such low speeds (well, technically, low "Reynolds Numbers") that primarily viscous forces in the fluid are significant, while inertial effects due to the mass of the fluid are insignificant. For example, think about an object moving slowly through a very thick sticky syrup. There are some YouTube videos showing viscous fluid mixing...

A more realistic approximation, resulting in more accurate drag forces for basically every game dynamics simulation I've ever seen, is to set the drag force magnitude proportional to the square of object's relative speed through the air/fluid. Slightly more expensive but not much more complex, and more accurate. This too is an approximation that in real life breaks down when things start to go haywire (onset of turbulence then again near the speed of sound), but can be a better choice IF "good" == "accurate" in your game physics.

The choice to use the square of velocity can have implications on the approach you choose to numerically integrate the equations of motion. That is all I will say about that here. It is well beyond the current level of discussion.

Graham
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
minor point about aerodynamic drag force from ep41
Actually, I was not trying to imply that the relationship was (or should be) linear. I was strictly pointing out that it was dependent on the velocity, and as such was an ordinary differential equation.

- Casey
Graham Rhodes
2 posts
minor point about aerodynamic drag force from ep41
Ah, Okay. I appreciate the reply and clarification, Casey. To be clear, I triggered on your use of the word "proportional" in the video stream, which does imply a linear relationship rather than a general correlation. Sorry for going into the weeds on this. The project is fantastic. You are doing an amazing job of explaining the how and why of everything, and that episode was simply wonderful.
Livet Ersomen Strøm
163 posts
minor point about aerodynamic drag force from ep41
grhodes
The project is fantastic. You are doing an amazing job of explaining the how and why of everything, and that episode was simply wonderful.


Yes. It's the most interesting material I have found, and I am looking forwards to every bit of it. Useful to read your post as well.

However, while knowing about things that work, is infinitely valuable, especially when you work for a living. It is also important to make mistakes. And some of them can become useful too. To me this is the difference between math and computers. The fun part. Of discover things that are "new", or even wrong, but sometimes useful still. If they truely work, for your specific game, then zimsalabim: You created math.