4 ms·
Two interesting things to point out: First, Angry Birds has used Erin Catto's Box2d physics library. I don't know about Angry Birds Space, but I assume they st
by exDM69 15y ago
Two interesting things to point out:
First, Angry Birds has used Erin Catto's Box2d physics library. I don't know about Angry Birds Space, but I assume they still use the same physics engine. However, they might have modified the lib to facilitate non-uniform gravity. As far as I know, they haven't contributed the changes back. Not that they're obliged to (by the license) but it would still be polite after making millions using that library. Or at least give credit to Mr. Catto.
Second is the "frictional force" mentioned in this article. As a hobby I do physics simulation code, I've done several gravity simulations. In order to get a stable simulation you need a very nice numerical integration method (I've used one called Runge-Kutta-Nyström, but there are others that work, maybe better). Game physics engines typically have a different kind of numerical integrator that is supposed to give stable results when lots of objects are stacked and colliding. I think that the source of the frictional force in AB:S is, in fact, the numerical error introduced by the integration method.
Different numerical integration methods have different error characteristics, e.g. the RKN method I've used "leaks" energy over time, so orbits decay over time. But I've gotten simulations to run for hundreds of orbits before a change in the trajectory becomes noticeable.
- bermanoid 15y agoThey probably aren't doing anything special with gravity - they're just applying a central 1/r^2 force to anything that touches the sensor region (the atmosphere, in this case). One of the Box2d testbed demos has a similar example, it's very simple to do. The frictional force is also pretty simple, likely just Box2d's linearDamping term, which very loosely models drag and exponentially slows down objects. Box2d uses symplectic Euler integration, which tends to be pretty good about conserving energy; it definitely wouldn't cause that much deflection from a stable orbit if the force was central.