6 ms·
The Physics of Angry Birds Space
- exDM69 15y agoTwo 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.
- adriand 15y agoInteresting point about gravity I came across in a book recently (The Beginning of Infinity by David Deutsch): > most non-physicists consider it self-evident that when you hold your arm out horizontally you can feel the force of gravity pulling it downwards. But you cannot. The existence of a force of gravity is, astonishingly, denied by Einstein's general theory of relativity. This says that the only force on your arm in that situation is that which you yourself are exerting, upwards, to keep it constantly accelerating away from the straightest possible path in a curved region of spacetime. I won't pretend to understand all of this (perhaps someone would like to explain it?) but it's interesting nonetheless.
- kmm 15y agoThis is hardly the place to discuss General Relativity but I can give a small explanation. Do you know the metaphor for gravity with a rubber sheet? Masses make dimples in the sheet and when particles pass, they get deflected. Similarly, when something moves past the Sun, it gets deflected and that's the reason we stay in orbit. Of course you could say you're holding your arm still and there's no reason for it to veer of course and suddenly start moving. But it actually is in motion, everything moves through time! It's this movement that gets deflected into spatial directions. We human observers have to move through time, we can't stop to get the big picture and that's why objects in the vicinity of masses suddenly start accelerating. ...Maybe I should write a book.