Camera Control Techniques for your Game

cameraControlTechniques1

When you’re playing your game, you may notice that the camera follows the player and is always centered on the player unless you’ve reached the edge or corner of the map.

Sometimes, you may want to focus the camera on a different object, or an arbitrary position on the map. For cut-scenes where the player is not involved, for example, you would typically have to set the player’s graphic to transparent and then move the player to the cut-scene’s location.  After the cut-scene is over, you would then move the player back to where they were.

This is not a difficult task, but it is not really something that you have to do just to look at somewhere else on the map. One solution that would make your cut-scenes and overall eventing experience so much easier is the ability to control the game camera using the Camera Target script.

Required

Camera Basics

We can consider the game to initially only have one camera. Whatever you see on the screen is through the lens of that camera. Through scripts, you can potentially add more cameras, but for now there is only one, and it follows the party leader. The leader is said to be the “target” of the camera.

cameraControlTechniques2

When you move your party around the map, the camera follows its target by sliding the map. Once you reach the edge or corner of the map where it is no longer possible to continue sliding, the camera will stay in that position until you move elsewhere.

How the script works

The Camera Target script provides a single function: changing the target of the camera to another character on the screen. Valid characters that you can choose are

  • The leader of the party
  • A party follower
  • An event on the map

The target is changed via script calls, which can be used using the script call command, or a move route command if you require the camera target to change during a move route.

cameraControlTechniques3

Camera Events

You can designate an event as the target of the camera. This will center the camera on the event, regardless how you move the party leader.

The event can be a visible event that you want to follow, such as an NPC that moves across the screen. You don’t necessarily want to have to figure out how to scroll the map while the event moves, or move an invisible player along with the event to accurately follow the event’s movements.

cameraControlTechniques4

The event can also be an invisible event, whose purpose is to simply move the camera around the map without having to scroll the map or change the player’s position.

This invisible event can remain at a particular position so that the camera is fixed to a particular position, or the event can move around to simulate map scrolling independent of any other characters on the map.

cameraControlTechniques5

Closing

By combining events and camera targeting, you can achieve a variety of effects in your cut-scenes without having to figure out how to coordinate the player or scroll the map so that the camera will correctly do what you want it to do.

Spread the Word

If you liked the post and feel that others could benefit from it, consider tweeting it or sharing it on whichever social media channels that you use. You can also follow @HimeWorks to get the latest updates or suggest topics that you would like to read about.

You may also like...

3 Responses

  1. rubydragon44 says:

    Might I request the ability to chose between pan-ing/ scrolling to a target versus instantly shifting to a target?
    I’m thinking of the script http://galvs-scripts.com/2012/10/20/cam-control/
    although yours has the ability to shift to followers. With his, to move to followers, you’d have to have an event that constantly moves to or teleports to the position of a follower that you have the game continously update. It’s a bit quirky feeling and laggy. I use scripts that allow me to move followers through commands, so your function is very useful. Galv is rather busy.

    • Hime says:

      I’m not sure how the followers are relevant to what you asked at the beginning but if you want to have the camera follow a follower you just need to pass in negative numbers.

  2. Moo says:

    Aww yeah, followers?!? That's awesome!

Leave a Reply to rubydragon44 Cancel reply

Your email address will not be published. Required fields are marked *