Thursday, July 26, 2012

Camera - Super Mario World


In many of the best retro platformers, rarely does the view remain static, centered on the player. It moves and adjusts based on particular circumstances.

Today I was taking a look at Super Mario World's camera and how it works, since it's a bit different. It can more or less be divided into 2 catagories, which I'd refer to as,

1. Fixed
2. Vertical

However, before explaining the difference let's take a look at horizontal movement, which is more or less consistent throughout the game.

Horizontal Movement


In this picture, the red line represents where Mario is oriented in the view. The blue area represents a sort of buffer zone. If the player continues to the right, Mario will always stay oriented on the red line. That is, Mario will remain slightly off-center. This gives the player a slightly larger view of what's ahead.


If the player moves back into the buffer zone, the camera position remains unchanged. This keeps the screen still during moments when the player needs to move backwards temporarily, keeping the focus on what's ahead.


If the player passes through the buffer zone, the camera shifts to to where the player is and the camera's orientation is reversed, with Mario now slightly to the right. The buffer zone is also flipped.

In this way, the focus is always on what's "ahead" of you, and doesn't switch simply because you go back a few steps. It only re-orientates itself if you leave the buffer zone, which is the game's way of deciding which way the player is going to go at a constant pace, rather than just temporarily.

With that out of the way, let's take a look at the first type of camera tracking.


Fixed


In the fixed camera mode, vertical movement is not tracked. That is, the camera does not oriented itself based on Mario's vertical location. Since the level is horizontal and ground based in nature, that's where the camera remains.


Mario can even leave the screen, and the camera will not move vertically.


It's also important to note that the camera's view does not go very far below the ground. (the lowest point where the player can safely stand). This is to avoid wasting the upper portion of the screen.



Vertical



Like fixed mode, upwards vertical movement is not tracked just by moving. Unlike fixed mode however, it does adjust based on platforms. When Mario lands on a surface higher than where he was previously standing, the camera shifts upwards to his location.


It's also interesting to note that when jumping up to a higher platform, the view seems to orient based on where the center of the screen would be if you were to ignore the hud, allowing you to see above and below equally. (since the hud obscures things above you somewhat, I suppose.)


Falling works in a different way. It's tracked a little more like horizontal movement, wherein you have a small buffer below you. I suppose this is so that the camera will not re-orientate itself if the platform you jump down to isn't that much lower than the one you were on.


After passing the buffer, Mario remains oriented slightly lower on the screen.

If you land on a lower platform from a higher one, the camera does not re-orientate where Mario is on the screen, since you're basically still at the end of the buffer the game uses for falling. This means that falling onto a platform orients Mario lower in the camera's view, whilst jumping to a higher platform put's him higher. (still with me?)


That's it.

To put it simply, the purpose of camera orientation is to avoid wasting important screen space, and to direct the player's attention. Mario uses the two types depending on the type of level, and where the player's attention needs to be, fixed for flat,  horizontally oriented levels, and vertical for levels with a lot of vertical movement. (I'm ignoring the camera movement when you use the cape, since that's a bit different.)

In the end it's a bit difficult to describe well, so next time you play Mario, or any other good platformer for that matter, try focusing on the way the camera moves, where the player is oriented on the screen, etc. I think you'll find that they tend to be a bit more complicated than just centering the player in the center of the screen, and it's one of the things that makes them work so well.


Anyhow, back to work -___-

15 comments:

  1. There are also games that center the camera on the most important source of action on the screen, or the most important target. This is also a feasible way of doing it. For things like boss fights against large creatures, putting the camera on the weak spot, i.e. making it the relative center of the screen, gives perspective to the enormity of what you're fighting.

    You can also have reactive camera focus, such as when you use a super, you close in on the super being used. This requires a certain amount of timing so that it doesn't interfere with survival or the fight. Space Marine is one failure on survival: it focuses on the kills to the detriment of your survival. Assassin's Creed uses the camera to highlight YOUR death in multiplayer, but doesn't to highlight your kills; therefore, it successfully helps with highlighting the action, but doesn't intrude on survival. In single-player, it only focuses in on special kills, stopping the ability of the enemy to hurt you while the kill is animating, giving you a flashy breather kill.

    Platformers usually only use non-player focus on things like bosses, but there have been times where it gives focus to mid-level events and such.

    How you use the camera can give dynamism to your game.

    ReplyDelete
  2. I like to get my mind blown by things I haven't thought of before. Thanks.

    ReplyDelete
  3. pssst : http://www.youtube.com/watch?v=TCIMPYM0AQg

    ReplyDelete
    Replies
    1. Mmm, never saw that before.

      Looks like he came to pretty much the same conclusions.

      Delete
  4. Why the hell was I just thinking about super mario world a half hour ago and now I suddenly see this?

    ReplyDelete
  5. Is there any particular reason as to why you're making this while seeking no help or advice?

    ReplyDelete
    Replies
    1. @Anon:

      Using other platformers(Especially wildy popular and very well designed ones) as a reference for camera movement is probably a better than asking random people on the internet.

      Analyzing camera movement in platformers is very useful, as it gives insight into how one should focus the camera in their own game. Posting the results of an analysis is just something Kyri likes to do. I found it highly interesting and even enlightening in a way.

      Delete
  6. I very much enjoy these discussions of design, it is very interesting and also helps give insight on your own design plan.

    One other key thing I think that makes the Mario games work so well is the relative size of the PC to the rest of the screen. I do find myself frustrated more often then not in games where the PC fills up a significant part of the screen, and I think I generally prefer it if they aren't any more then 1/12 of the screen in size.

    ReplyDelete
  7. I tried to implement this on the earlier stages of my game, but when the camera stop, the movement looked weird because I'm running at 25 Fps, it was there when I learned that a video game should almost always run at 60 fps :P

    ReplyDelete
  8. Hmm, Truly interesting indeed. It's always fascinating to understand the inner workings of games.

    @Uriel
    Yeah, when your games run under 60fps it becomes so bothersome that it can drive you mad. I've had that issue with some PS2 and Gamecube emus, it's like instead of a game with flowing movement you're just seen a proggression of screenshots.

    ReplyDelete
  9. Thanks again for sharing your thoughts, the input is really appreciated. I'm actually considering getting into game development myself. I'm currently trying to learn C++ (more ideas then talent or skill unfortunately ^_^;), so things that give a break down of the world in simple linear terms is very insightful.

    Anyway looking forward to your game, keep up the good work!

    ReplyDelete
  10. You are the best
    Seriously, I love that you take the time to do these little game design articles
    Fucking fascinating!

    ReplyDelete
  11. No one said anything about how the game allows for an instinctive vertical camera movement letting the player see what's below you so that you don't have to do those "leaps of faith".
    I loved that thing.

    ReplyDelete
  12. well, are you from hk?

    ReplyDelete
  13. Well... I got to admit that I never paused to consider the camera in a 2d game, unless it's one of those annoying games that kept your character near the front edge of the screen.

    Offhand, I can't help but feel as if most of the platformers I've played do use the simple "keep the character in the middle of the screen no matter what"... Maybe that's part of what makes Mario just "feel" so good control-wise.

    ReplyDelete