AuthorTopic: Platformer Camera  (Read 3829 times)

Offline Winston

  • 0001
  • *
  • Posts: 51
  • Karma: +0/-0
    • View Profile

Platformer Camera

on: July 13, 2008, 05:30:26 pm
So I've started making  a platformer game! Actually I started like a year ago...
Anyways I wanted to know what everyone thinks would be the best kind of camera for the game? Like cavestory or Metroid.
The game plays with a combat system based on supersmash brothers, but it's one player
It's time for racing car video games

Offline AlexHW

  • 0100
  • ***
  • Posts: 1037
  • Karma: +0/-0
    • View Profile
    • AlexHW

Re: Platformer Camera

Reply #1 on: July 14, 2008, 01:42:24 pm
entirely up to you.. you have to weigh the pros and cons of either choice.
one is a fixed position, while the other moves with the character. the thing with the fixed position i sthat the game becomes segmented into little capsules, while the scrolling one the areas can be more dynamic.

Offline Ben2theEdge

  • 0011
  • **
  • Posts: 503
  • Karma: +1/-0
  • I'ma drink mah coffee!
    • View Profile
    • My Deviantart Gallery

Re: Platformer Camera

Reply #2 on: July 14, 2008, 02:05:30 pm
This is an interesting topic because it's often neglected, even in professional games.

I hate panhandle cameras (where the camera rigidly follows the player with pixel precision) and I also get annoyed by cameras that constantly sweep around to adjust to your direction. The best option in my humble opinion is to just set the camera to (player position * 0.9) or thereabouts. That way the camera will follow your movements with precision but will automatically make its motion buttery-smooth. It's the best of both worlds, in my humble opinion.

With platformer games I also prefer to make it so the camera's Y movement stays pretty static. When the camera follows you up and down with every jump it makes me feel a little bit sick. So I usually set it to only adjust itself whenever your feet land on a platform, or if you get too close to the top or bottom of the screen. Depending on the gameplay though this isn't always a good idea.

I've always thought the Megaman X games had an exemplary camera system, because the camera seems to move on a track for the most part; during long horizontal stretches the camera only moves horizontally. During vertical sections the camera only moves vertically. I imagine this requires a little more work to program (I'm still trying to figure out the most effective way of doing it) but it's a nice way to cut out a big beef I usually have with cameras: when they follow a character too rigidly you end up with half a screen of wall or floor. Especially in action games this is a horrible waste of precious viewing area.



It's an extra step to tell the camera where a playable area ends, but I think it's well worth it. Of course there are exceptions to this philosophy depending on the needs of the game but I think you need pretty good justification to fill half your playing area with floor tiles. Seasoned designers, feel free to dispute. ;D
I mild from suffer dislexia.

Offline huZba

  • 0010
  • *
  • Posts: 409
  • Karma: +1/-0
    • MekaSkull
    • http://pixeljoint.com/p/19396.htm
    • huzba
    • View Profile

Re: Platformer Camera

Reply #3 on: July 14, 2008, 04:48:17 pm
As far as i can tell, in MMX the camera is always horizontally locked on megaman unless there is void at the edge of the camera, like how ben illustrates. When there is room to move up and down, the camera is also locked vertically on megaman, with a few tiles worth of space to move about before the vertical scroll starts.

Having a spot in the middle of the edges of the camera that check for void tiles might be enough.


So whenever the indicator goes red, camera stops movement to that direction.
In mmx1 highway stage there's nothing above and below, so up and down are red. When you enter the bee boss, it sort of artificially sets all red, when you destroy it, it's all green again until you drop down and there's void on either side of the screen. When you hop up, the right edge is red till you hop above the ledge and the camera resumes horizontal lock.

Offline Winston

  • 0001
  • *
  • Posts: 51
  • Karma: +0/-0
    • View Profile

Re: Platformer Camera

Reply #4 on: July 15, 2008, 12:03:05 am
This is an interesting topic because it's often neglected, even in professional games.

I hate panhandle cameras (where the camera rigidly follows the player with pixel precision) and I also get annoyed by cameras that constantly sweep around to adjust to your direction. The best option in my humble opinion is to just set the camera to (player position * 0.9) or thereabouts.
I'm probably just being dumb but what do you mean by *0.9?
It's time for racing car video games

Offline Sherman Gill

  • 0011
  • **
  • Posts: 995
  • Karma: +0/-1
    • View Profile

Re: Platformer Camera

Reply #5 on: July 15, 2008, 03:55:00 am
Multiply by 0.9.
Oh yes naked women are beautiful
But I like shrimps more haha ;)

Offline Ben2theEdge

  • 0011
  • **
  • Posts: 503
  • Karma: +1/-0
  • I'ma drink mah coffee!
    • View Profile
    • My Deviantart Gallery

Re: Platformer Camera

Reply #6 on: July 15, 2008, 04:14:39 am
Yeah... that calculation is actually wrong, I think. Math is not my strong point, that's why I will never be a real programmer, haha.
The idea is to set the camera to the average position between the current camera position, and the player position.

I guess the correct formula would be (camera position + player position)/2

Or you could make it even looser (camera position*4 + player position)/5

I just looked at Skeletroids to see what the formula I used there was, and it's the most ugly unholy calculation I have ever looked at in my life... I don't even remember how I came up with it... like I said, I am not a mathematician...  :-X
« Last Edit: July 15, 2008, 04:16:46 am by Ben2theEdge »
I mild from suffer dislexia.

Offline Dusty

  • 0100
  • ***
  • Posts: 1107
  • Karma: +0/-0
    • View Profile

Re: Platformer Camera

Reply #7 on: July 15, 2008, 04:32:59 am
I typically just like a camera that's attached to the player until the player reaches boundaries(which the camera would stop moving when the view[resolution] reaches the end of the screen).
Though, for a platformer, it may be more beneficial to have that position a little behind the player. It's always good to see more ahead of you, and since generally in platformers you move left to right...

Offline Beoran

  • 0010
  • *
  • Posts: 112
  • Karma: +1/-0
    • View Profile

Re: Platformer Camera

Reply #8 on: July 17, 2008, 04:08:29 pm
Actually, a simple way to get the camera to behave is to have certain tiles on your tile map act like camera (invisible) scroll block tiles. When the viewport collides with one of those blocks, further motion is not allowed in the direction of the "scroll block tile". That way you can design your levels in a very flexible way.
Kind Regards, Beoran.

Offline Xion

  • 0100
  • ***
  • Posts: 1551
  • Karma: +0/-0
    • View Profile
    • FourbitFriday

Re: Platformer Camera

Reply #9 on: July 17, 2008, 04:33:36 pm
how ben said do it is how I like to do it - average of the current camera position*a multiple and the player's position. This makes camera movement smooth but it never really lags too far behind or moves too slowly, since it moves faster the farther the player gets from it's focus.