The need for a robust, flexible camera system really cannot be overstated. And it kind of stinks, too, because you need to devote a lot of thought, time, and attention to a feature that will - at least ideally - go completely unnoticed. Blood Alloy started out with a very basic camera system, common to many first-effort platformers.

Many simple platform games set up an invisible set of boundaries on the screen, and when your character’s position intersects one of these boundaries, the camera moves to keep you within this invisible box.

Super Metroid’s camera system was revolutionary for its time. As a huge Metroid fan, I started poking around with it and studying it just a few months ago and came away enormousy impressed.

Super Metroid’s camera, instead of using the player’s relative position, uses the player’s velocity.

Normally, camera tracking entails simply matching the camera’s velocity to the player velocity when the player’s relative position to the camera reaches a certain delta.

So in this example, the camera is tied to the player to keep the player within the red box. If the player moves right at vX = 5, then the camera also moves right at vX =5, thus preserving the player’s relative position.

Make sense?

But that’s not how it works in Super Metroid!

In Super Metroid, as you start to move to the right, the camera actually moves to the right at a FASTER rate.

So if the player moves to the right at vX = 5, say instead the camera moves to the right at vX = 10.

What this does it is shifts the player to the left side of the screen - and if you intend to shoot enemies in front of you, that’s pretty helpful!

Of course the camera velocity sets back to match the player’s velocity once the relative distance delta reaches a cap, so that the camera doesn't leave the player behind.

What’s also nice is that this same effect is used for vertical movement - so when you jump up, you can see enemies above you, and -perhaps more importantly - when you start falling, you can see below you to see where platforms and hazards are.

Great!

This works wonderfully for Super Metroid because enemies are almost always coming at you horizontally. Very, very few enemies actually shoot projectiles at you, and the ones that do either shoot horizontally or in short parabolic arcs.

However, in Blood Alloy, we have enemies shooting at you from literally every possible angle. Furthermore, you have 360-degree aiming capability at pretty much all times. While you’re moving, it’s just as likely that you’ll be shooting an enemy ahead of you as shooting something behind you.

Super Metroid’s camera system wasn’t going to solve all of our problems.

So we juggle SM’s camera system with camera “pulling” by the mouse.

You can check out an abbreviated version of my code here below.

targetX and targetY represent the X and Y coordinates that the camera is lerping to based off of the Super Metroid camera system.

The following code is for calculating and implementing how much the camera should follow the mouse.

And here’s the result:

Feel free to let me know if you have any questions!

-Frank