Super Mario Galaxy
earned acclaim for emulating a sense of gravity and real-world figures, allowing gamers to walk upside down while feeling completely intuitive. But how did they do it?
Even Isaac Newton might be perplexed:
"In Galaxy, players are pulled toward each and every arbitrarily shaped planetoid they encounter. At this point all real world physics equations break down and tell us nothing about the gravity in the game, which as in most cases is a trick. Much like the magicians in The Prestige, game developers are always attempting to one up each other with new tricks. As we all know, Nintendo stole the show with its latest.
To accomplish this "trick", the developers use the surface normals of whatever planetoid Mario inhabits to keep him running and jumping happily along. This is how gravity is distributed through completely irregular bodies. A surface normal is a ray or unit vector that runs perpendicular to a plane.
And how does Mario adjust so smoothly to Galaxy
's often oddball, irregular surfaces? There are a combination of factors:
"irst and easiest to understand is that each planetoid in the game is fairly high polygon so the change from one surface normal to another isn't too steep. Additionally, interpolation can be used to smoothly transition from one orientation to the next. So, the surface normals in a Galaxy planetoid are analogous to the key frames of an animation in that regard.
To demonstrate these concepts we'll be looking at some high-level source code we've created - written in Blitz3D, which is an excellent tool for prototyping concepts just like this. You'll need to download a demo or full version of Blitz3D to edit and re-compile the code.
The full feature contains further details
, with source code and a playable prototype (no registration required, please feel free to link to this feature from other websites).