How to make your game's camera not suck
Ever played a game and felt that it was off, but couldn’t put your finger on why?
It might be the camera.
Let’s fix that.
Slapping together a follow-the-player camera and calling it a day is all too tempting.
That’s how you get:
- Enemies coming “out of nowhere”
- Jerky feeling when changing directions
- Seeing stuff you aren’t supposed to
We can do better.
A subset of camera techniques
Position Locking: Sticks to the player. Simple but limiting. (default) Lerp-Smoothing: Follows smoothly. Faster when far away. (default) Edge-Snapping: Stops at edges. Good for hiding out-of-bounds. Camera-Window: Moves when the player hits the edge of an invisible box. Forward-Focus: Snaps to have plenty of space ahead.
Let’s make a metroidvania camera
What a metroidvania needs:
- See the enemies
- Spot traps and terrian
- Backtracking
- Vertical exploration
- Hide unreachable areas
My recommendation? Mix these as a great starting point:
- Edge-Snapping Hide adjacent and out of bounds zones.
- Camera-Window (vertical): Simple vertical exploration.
- Dual-Forward-Focus: Forward-focus both ways. See what’s coming.
Later, I’d think about having different camera styles for different rooms.
Some rooms may have trigger zones that change the camera style.
Platform-Snapping: Snaps the camera to the platform Y level once the player lands. For vertical rooms.
Wrap-Up
Shipping with a default style camera may be fine for your game.
It’s a good idea to consider your options.
Details like cameras are overlooked by devs, but the players notice when it’s not right.
Make great games.
References
This article is the ultimate guide to 2D cameras. I recommend checking it out.
Scroll Back: The Theory and Practice of Cameras in Side-Scrollers - Itay Keren