Tuesday, April 28, 2015

First steps for a game camera

The first version of a camera tracking a target on screen could be a fixed offset from the center of the target with the camera looking straight along the offset.

This is really all there is to get started and it is time to think about the next steps. This is a few questions to ask about the game before deciding on a direction for the camera that will influence level layout, art detail, how far sounds need to be heard and much more.

There are a lot of considerations when framing multiple targets at once but to reduce the scope this post will focus on game cameras with a single target. This post does not contain anything new, it is intended as a checklist to get started with a game camera.

Different camera distances

Any artistic qualities for framing subject would require a far longer post so instead I will resort to suggest defining some metrics at this point;

  • Camera distance
  • What parts of the player are important
  • How camera height affects the experience
  • Field of view
  • Screen fit

These can be found early in production and inform the shape of gameplay space. Work in art, audio, rendering performance and possibly AI departments will depend on choices that frames the player’s view and agreeing on the boundaries for camera framing should include all departments of game development.

Cutscenes are intentionally breaking the boundaries for normal gameplay so additional considerations outside of gameplay camera boundaries is likely in sections that contain cutscenes.

Before trying to determine the limits of a camera it is useful to define the camera modes for the game, which should be informed by what is most useful for players to see. Over the shoulder camera modes are great for games that have a lot of opportunities for aiming, a farther camera such as a leash camera mode is useful to see more opponents behind the player. Possible vehicular sections may require a custom vehicle mode.

Camera distance to target is easy to visualize which makes it a good first step.

How far and close can the camera be? while the player could look great up close, is there a chance that gameplay could be obscured by the camera target?

Thinking about the opposite, how small can the player be on screen and still visible enough that the action is readable?

If a larger distance is defined it will also need to work with player input, for example if the player has orbital camera control how wide should game corridors be to comfortably fit the camera orbiting around the target?

At the farthest local distance, can the player and the camera fit around narrow corners?

Corridor turn too tight for camera distance

There are probably multiple sets of distances to define, especially if the game calls for multiple camera modes that game design can switch between in different sections.

Determining what part of players should be visible on screen is useful for future steps such as how to react to collision. An over the shoulder style camera the feet will be less of a priority than the head.

Camera height above ground is another metric for gameplay layout. If the camera is too low then low obstacles will also obscure the view, and if too high solid visual occluders may need to be unnaturally high to function. Detail of ground material may need to be higher if the camera can be very close.

Camera height above ground

The height above ground will also influence the camera pitch, or the orientation around the horizontal axis, where a higher up camera will also have the horizon line higher on the screen. The horizon line is important and if the pitch angle minus half the vertical field of view angle is downwards that means that the player can not see the horizon.

If the camera is over the shoulder the pitch is likely zero or very small to help align the player with what the player character would see. This also means that the environment art needs to hold up as if you were standing in the game world, similar to the level of detail of a first person game.

If the layout relies on visual occlusion in rendering a higher camera may mean the occluders may also need to be higher than what looks natural.

Having a more distant camera and not seeing the horizon is an option for some games but at that point the game will be a top-down experience rather than a “level” perspective. Personally I think it is important to remain consistent and either always show the horizon or always look down, since this is a large part of how the player understands the game world.

Field of view is a metric that is commonly handled by feeling, but there are some specific considerations that can weigh into the choice as well. At a low field of view angle the camera will need to be farther away from the player to keep the player the same size on screen. This means it is easier for the camera to get trapped in collision. At a large field of view the game will get a fisheye feel and shapes in the distance get smaller quicker. It can be hard to estimate jumps with larger field of views, especially if the pitch angle is low.

Fitting a shape into the same screen shape with different fields of view

It is hard to estimate what a “correct” field of view should be for the observer, a small TV a certain distance away would only allow for 20 degrees if we modeled it as a window on the wall, but for a large TV very close it might be as wide as 120 degrees. It will take some tuning to find a value that improves the experience of play.

Changing the field of view during gameplay is a useful tool to give a sense of speed or insanity to certain scenes but I personally prefer when action games stay consistent with field of view during regular gameplay.

In addition to considering the camera in the game world it is important to consider the game world on the screen. What part of the screen are covered by overlays that may obscure the view?

Screen limits for gameplay

User control of the camera is a choice. There is no problem just saying no, or to decide not to allow vertical camera movement, etc. There is a problem with occasionally disabling user control or limiting the range players can control the camera inconsistently throughout the game. If you get used to some looking around freedom it will feel like the game is hiding something in sections where that freedom is restricted. The metrics for user control include range of pitch angles and total height above the ground that the user can pull the camera to.

If the game has a strong puzzle element that includes actions such as finding required objects the user camera control can be very important. If the game calls for dramatic or very designer driven cameras it can be best to simply not allow user camera control.

While the camera limits are being discovered in the early stages of game development there is usually exploration into what the game world’s shape is going to be and artistic development for good focal distance and more. During the initial phases it is important to gather metrics and not get too attached to decisions that get in the way of iterating. If an initial set of camera limits were discovered but the game world isn’t fitting the camera well it may be time to review the camera modes or even change what the shape of the world is.

Keep in mind what you will try to address at the end of development as well as throughout, grand vistas and lots of height variance is a pretty prototype but will the performance hold up when the game is finished and the screen needs to show all that detail?

No comments:

Post a Comment