Super Mario Galaxy Demystified (with source code !)

There’s a nice little writeup on Gamasutra describing how the crazy gravity in Super Mario Galaxy was implemented, including demo sourcecode. It’s not ‘real’ physics (no surprises there ….). Essentially, Mario’s orientation is corrected to smoothly align with the surface normal of the closest ‘ground’ polygon.

This is the first in a new series of “Games Demystified” articles on Gamasutra … I’m looking forward to more of these.

It also begins to explain the annoying little bug in one of the boss battles with Bowser, where he can float off and never return:

The final component of the updatePhysics() function checks the planetoidClass list to see if we’re actually closer to some other planetoid. If we are then we switch planetoids so the next time updatePhysics() is called we’ll check with this new planetoid to calculate gravity.

Presumably¬†in Super Mario Galaxy, the planetoid gravity has some sort of cutoff radius. If there is no other planetoid to ‘fall’ to, things just float away (or maybe into a Black Hole) … this is what happens to Bowser if he just happens to launch off the small platform rather than the planetoid surface – he leaves the cutoff radius and just floats away, leaving Mario unable to complete the level. I guess this is the only way Bowser can really win :)