David M. Bourg

Mentioned 5

Offers advice for using physics concepts to increase the realism of computer games, covering mechanics, real-world situations, and real-time simulations.

Mentioned in questions and answers.

I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian programming.

Are there any good resources out there for a guy with a limited attention span (say 20 minutes apiece for a subject I'm keenly interested in) to learn, gradually, how to do something more useful with math in programming?

I'm currently going through "Physics for Game Developers" by David M. Bourg. So far, I'd recommend it.

It provides the math-y concepts behind physics that can easily be applied to the 2D realm to spice up your games a bit.

I am fascinated by the performance of applications such as "Rollercoaster Tycoon" and "The Sims" and FPS games. I would like to know more about the basic application architecture. (Not so concerned with the UI - I assume MVC/MVP piriciples apply here. Nor am I concerned with the math and physics at this point.)

My main question deals with the tens or hundreds of individual objects in the simulation (people, vehicles, items, etc.) that all move, make decisions, and raise & respond to events - seeming all a the same time, and how they are designed for such good performance.

**Q: Primarily, are these objects being processed in a giant loop, one at a time - or is each object processing in it's own thread**? How many threads are practical in a simulation like this? (Ballpark figure of course, 10, 100, 1000)

I'm not looking to write a game, I just want the design theory because I'm wondering if such design can apply to other applications where several decisions are being made seemingly at the same time.

In addition to the suggestions posted I would recommend browsing the simulation tag at sourceforge. There are a variety of simulation project at varying levels of complexity.

Also I recommend the following book for a basic overview, While it is focused on physics it deals with issues of simulation.

I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real problem is reading complex formulas and such, so I'm looking for some decent rigid body dynamics references that will make some sense.

Anyone have any good references?

Physics for Game Programmers I think is better than Physics for Game Developers.

If you want something thick in your bookshelf (like I do), Eberly's 3D Game Engine Design and Erleben's Physics-Based Animation can accompany the above.

Does anyone have any good references for equations which can be implemented relatively easily for how to compute the transfer of angular momentum between two rigid bodies?

I've been searching for this sort of thing for a while, and I haven't found any particularly comprehensible explanations of the problem.

To be precise, the question comes about as this; two rigid bodies are moving on a frictionless (well, nearly) surface; think of it as air hockey. The two rigid bodies come into contact, and then move away. Now, without considering angular momentum, the equations are relatively simple; the problem becomes, what happens with the transfer of angular momentum between the bodies?

As an example, assume the two bodies have no angular momentum whatsoever; they're not rotating. When they interact at an oblique angle (vector of travel does not align with the line of their centers of mass), obviously a certain amount of their momentum gets transferred into angular momentum (i.e. they each get a certain amount of spin), but how much and what are the equations for such?

This can probably be solved by using a many-body rigid system to calculate, but I want to get a much more optimized calculation going, so I can calculate this stuff in real-time. Does anyone have any ideas on the equations, or pointers to open-source implementations of these calculations for inclusion in a project? To be precise, I need this to be a rather well-optimized calculation, because of the number of interactions that need to be simulated within a single "tick" of the simulation.

Edit: Okay, it looks like there's not a lot of precise information about this topic out there. And I find the "Physics for Programmers" type of books to be a bit too... dumbed down to really get; I don't want code implementation of an algorithm; I want to figure out (or at least have sketched out for me) the algorithm. Only in that way can I properly optimize it for my needs. Does anyone have any mathematic references on this sort of topic?

Well, my favorite physics book is Halliday and Resnick. I never ever feel like that book is dumbing down anything for me (the dumb is inside the skull, not on the page...).

If you set up a thought problem, you can start to get a feeling for how this would play out.

Imagine that your two rigid air hockey pucks are frictionless on the bottom but have a maximal coefficient of friction around the edges. Clearly, if the two pucks head towards each other with identical kinetic energy, they will collide perfectly elastically and head back in opposite directions.

However, if their centers are offset by 2*radius - epsilon, they'll just barely touch at one point on the perimeter. If they had an incredibly high coefficient of friction around the edge, you can imagine that all of their energy would be transferred into rotation. There would have to be a separation after the impact, of course, or they'd immediately stop their own rotations as they stuck together.

So, if you're just looking for something plausible and interesting looking (ala game physics), I'd say that you could normalize the coefficient of friction to account for the tiny contact area between the two bodies (pick something that looks interesting) and use the sin of the angle between the path of the bodies and the impact point. Straight on, you'd get a bounce, 45 degrees would give you bounce and spin, 90 degrees offset would give you maximal spin and least bounce.

Obviously, none of the above is an accurate simulation. It should be a simple enough framework to cause interesting behaviors to happen, though.

EDIT: Okay, I came up with another interesting example that is perhaps more telling.

Imagine a single disk (as above) moving towards a motionless, rigid, near one-dimensional pin tip that provides the previous high friction but low stickiness. If the disk passes at a distance that it just kisses the edge, you can imagine that a fraction of its linear energy will be converted to rotational energy.

However, one thing you know for certain is that there is a maximum rotational energy after this touch: the disk cannot end up spinning at such a speed that it's outer edge is moving at a speed higher than the original linear speed. So, if the disk was moving at one meter per second, it can't end up in a situation where its outer edge is moving at more than one meter per second.

So, now that we have a long essay, there are a few straightforward concepts that should aid intuition:

- The sine of the angle of the impact will affect the resulting rotation.
- The linear energy will determine the maximum possible rotational energy.
- A single parameter can simulate the relevant coefficients of friction to the point of being interesting to look at in simulation.

You should have a look at Physics for Game Developers - it's hard to go wrong with an O'Reilly book.

I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction.

I was wondering if anyone has experience with this and can give me some advice or point me in the right direction of what is essential and the best way to go around doing such a thing.

Thanks in advance.

Frank.

At the Samples of the Windows Mobile SDK (check out the WM 6.0 SDK too), there are a couple of game applications. One of them is a simple puzzle game; not much, but it is a starting point.

The use of physics in game development is not specific for Windows Mobile. You can find a huge literature about this subject. This comes up in my mind now. If you are serious about game development, in any platform, you should do a little research first.