Contents
Games Demystified: Super Mario Galaxy
 
 
Printer-Friendly VersionPrinter-Friendly Version
 
Latest News
spacer View All spacer
 
November 22, 2009
 
Video Game Watchdog National Institute On Media And The Family Shutting Down [11]
 
Modern Warfare 2 Infinity Ward's 'Most Successful PC Version' Yet [12]
 
New Tech, Design Details Of Project Natal To Emerge At Gamefest In February
spacer
Latest Jobs
spacer View All     Post a Job     RSS spacer
 
November 22, 2009
 
Sucker Punch Productions
Character Artist
 
Sucker Punch Productions
3D Environment Artist
 
Sucker Punch Productions
Network Programmer
 
Sucker Punch Productions
Texture Artist
 
Sony Online Entertainment
Brand Manager
 
Monolith Productions
Sr. Software Engineer, Engine - Monolith Productions - #113767
 
Crystal Dynamics
Sr. Level Designer
 
Gargantuan Studios
Lead World Designer
spacer
Latest Features
spacer View All spacer
 
November 22, 2009
 
arrow Upping The Craft: Susan O'Connor On Games Writing [6]
 
arrow Small Developers: Minimizing Risks in Large Productions - Part II [6]
 
arrow iPhone Piracy: The Inside Story [48]
 
arrow And Yet It Grows: Analyzing the Size and Growth of the European Game Market [5]
 
arrow NPD: Behind the Numbers, October 2009 [13]
 
arrow Reflecting On Uncharted 2: How They Did It [5]
 
arrow Sponsored Feature: Rasterization on Larrabee -- Adaptive Rasterization Helps Boost Efficiency
 
arrow Postmortem: Wadjet Eye's The Blackwell Convergence [2]
spacer
Latest Blogs
spacer View All     Post     RSS spacer
 
November 22, 2009
 
Accepting the Inherent Value of Games
 
Planckogenesis, Part II: Song Structure & Gravy Train [1]
 
Designing Games Is About Matching Personalities [1]
spacer
About
spacer News Director:
Leigh Alexander
Features Director:
Christian Nutt
Editor At Large:
Chris Remo
Advertising:
John 'Malik' Watson
Recruitment/Education:
Gina Gross
 
Features
  Games Demystified: Super Mario Galaxy
by Jeremy Alessi
10 comments
Share RSS
 
 
March 27, 2008 Article Start Previous Page 4 of 4
 

 

The first 4 parameters are pretty easy to understand. We pass our player character and the 3 components of the surface normal to the function. The final 2 components are a bit trickier. The first of the two represents the axis we want to align along. For our implementation we want to pass a 2 for the Y-axis.

Advertisement

This means we want to align the character to this vector along his local up-down axis. The final parameter should be a floating-point number between 0 and 1, which represents the speed at which the character will snap to the vector.

In this case a 1 has been passed to make the alignment immediate. Smaller values will allow for interpolation between the previous alignment and the new alignment.

Next, we check to see if we are colliding with the planetoid or if we are above it because we jumped or are in orbit.

The EntityCollided() call requires two parameters which are the player character entity and the collision type mask we want to search for.

At the top of the program we created two types of collision masks. The first was a DYNAMIC type and the second was a STATIC type.

Obviously, the player character is dynamic and the planetoids are static because they don't move. So this call tells us if the player character of collision type DYNAMIC has collided with some other object (any other object) of type STATIC.

If we are colliding then we set our jumpTimer to the current time and we zero out our velocity. In the updateControl() code we allow the character 250 milliseconds of boost along the surface normal for jumping.

Once those 250 milliseconds are exceeded (or the player lets go of the jump button) the jump force will no longer be applied and the character must touch base to jump again. Finally back in the updatePhysics() call if we aren't colliding then we subtract the current surface normal from our velocity and translate our character back toward the planetoid.

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.

Conclusion

In closing, it's obvious that there is much more to Super Mario Galaxy than the cool gravity mechanic the developers employed. Although the included source code covers things like camera tethering and control, it only scratches the surface of what went into making Super Mario Galaxy a polished gem and an achievement in gameplay.

Of course, the one feature that wasn't included in other Mario games was the gravity effect and that's what distinguished Galaxy from the rest of the series and indeed the rest of the industry this past holiday season.

Hopefully, this segment of Games Demystified offered a useful peek inside the underpinnings of game development. Until next time... Waahoo!

 
Article Start Previous Page 4 of 4
 
Comments

Soren Andersen
profile image
Funny to see this article now. Three weeks ago we gave up on getting this to work in a HL2 Source mod. We ended up making a flat world instead (se my website link for the mod profile page on moddb.com)

Dan Mitchell
profile image
Excellent article. I cannot wait till the next on Very informative, and educational. I love seeing articles like this, since it helps cut down time on dev time/ research thus allowing others sections of the dev project more time, allowing for even more innovation.

Giuseppe Navarria
profile image
Nice article so far, maybe the tecnique you explained is a bit rought, for example movement will be smoother with normals interpolation, also a simple raycast will lead you in a sea of gameplay glitches...
PS Next time, set your example NOT at 640x480 fullscreen, or it will crash for users without a prehistoric monitor supporting that low resolution, I had to download the source and recompile it running on a window to see your stuff!

Marty Plumbo
profile image
I used a technique very similar to this in Shockwave3D a couple of years back to create my freeware game Microbop (http://gigaplay.com/microbop).

If it can work in Shockwave3D, it can work anywhere! ;-)


Robert Dowling
profile image
This was a great little read. I'm no engineer myself, but it may cut a little research time off my coding partner's schedule.

Andrew Williams
profile image
Great article, this looks like its going to be a great series. On a side note, If anyone is familiar with Sonic Adventure 2 battle, or just Sonic Adventure 2, the space levels in that game seemed to use a very similar technique to what we see in galaxy, however I do believe that to jump from planet to planet required a cannon of sorts. Anyway, great article, hope to see another soon.

paul grenfell
profile image
Good article. Looking forwards to more in the series :)

Now check out Serious Sam's gravity handling. They did it using zones (defined in the level editor) and it works very well. It is also easier to implement well since you don't need to worry about any smoothing. I suspect that SMG may well have used a hybrid of these two approaches.

Jose Eduardo Teran
profile image
Great article; a nice approach for understanding the world of physics in games.

This will help us to acquire some more basic knowledge about gravity and it's use on games, which are very demanding right now.

Keep up the good work, and I want to read the next ones.

Marc Melvin
profile image
I am a little annoyed that I'm just coming across this article today, but I'm also relieved that my method for doing similar logic in a game I was building for Dream.Build.Play using XNA is right on target with the logic used by a previously successful game title.

The only problem I ran into using this method was that snapping an object instantly to a new surface normal sometimes caused its ray to hit the polygon that it was previously using to calculate its up vector (when moving slowly along a "downward" slope, that is). I ended up scrapping this method because of the jittery back and forth effect that it was causing, eventually spiraling the object out of control into oblivion... maybe if I had LERPed the rotation slowly as mentioned in this article, I wouldn't have had the problems that I did.

Oh well... live and learn. Good article! :)

Tom nguyent
profile image

I love mario brother, I used to play all day when i was a kid...missed them :)


none
 
Comment:
 


Submit Comment