Camera angles By Chris Hinkey (cmh209) Standard game camera angle techniques Camera controllers...

34
Camera angles By Chris Hinkey (cmh209) Standard game camera angle techniques Camera controllers Replay camera angles

Transcript of Camera angles By Chris Hinkey (cmh209) Standard game camera angle techniques Camera controllers...

Camera angles

• By Chris Hinkey (cmh209)

• Standard game camera angle techniques

• Camera controllers

• Replay camera angles

• Don’t need to do much if the game is in 2D

• When your game is 3D and dynamic is when some problems come in

Why we need a good camera system

• If done right cameras will not be noticed • If done wrong everyone will notice the

slightest flaw • Jittery cameras are not good for fun game

play• If you can not see the hero well it is hard

to react successfully • Having to fix the camera manually as a

user is annoying

Requirements of a good camera system

• Able to change from user input • Continuously see a clear view of the desired

character. • Give special attention to important events • Anticipate characters movements as well as

possible• Have a clear view of the path of the character

Problems with doing this

• Not able to pre-process the environment

• Not able to hard code where the camera needs to go

• Avoid obstacles from being in between the camera and the character

Avoiding obstructed view

• How to do this, pros and cons

– Raycast collisions

– Multi-raycast

Attraction points

• The camera moves to different pre defined points depending on where the character is located

• Works well for small maps• Could possibly cause a jittery camera• Doesn't work as well with a dynamic

environment

Raycast collisions

• Cast out one ray from the character to the camera

• Set the camera from any clear path in between the camera and the character

• This causes sudden camera movements

• Some ways around this?

Multi-raycast

• Send out four rays from the character around where the camera should go

• Should the camera move away from object?– If any of the four rays is hit by an object move away from that

object

• Should the distance be shortened?– If a clear path can be obtained zoom in

More on Multi-raycasts

• Smoothing– Used to deal with tunnel situations – Use more zooming in to get around obstacles

• Camera transitions (switching characters)– a function occurs to calculate the new

camera position for the new character.

Intelligent Camera Control

• Typical architectures and the problems

• A better way to build a camera control system

Typical camera architectures

• Starts with a few monolithic behaviors that only work well for predictable behaviors

• Then fixes are added for certain cases where the camera is broken

• This causes a very fragile camera system to code

• Trade off between fixing a problem and possibly breaking something else

• This focuses more on the subject not the camera

A better way to do things

• The camera should be thought of as a primary character

• Should be based on lightweight behaviors to allow easy design process

• Easy addition of new behaviors• Easy way to switch between these behaviors

• How do we do all this

Implementation

• Camera fragment class – Simple math processor– Camera behavior– Updates camera every frame – Receives camera location matrix and

generates the new camera position – Generalized code that can be reused in many

projects

Camera Fragment class

• Three update components – position– Height with respect to terrain – Look at and field view (make sure object is in

view)• These are to be preformed in order

Implementation continued

• Camera Controller class– An interface between the game and the Camera

Fragment class – In charge of creation/destroying, ordering, activation

and updates to different fragments– Will create fragments and put them in a specified

order – During each update the controller will cascade

through the fragments and generate a new location– No way to turn fragments on and off

Adding some AI

• There is some lack of flexibility, lets fix that • Rules

– Add rules that turn fragments on and off– Used within both controller and fragment classes– Fuzzy rules would add a level of flexibility (too close,

not too far)– Works better for systems with fewer fragments – Hard to reorder fragments using this technique

State Machines

Controller class can have a simple Machine having a rule set to traverse through the states

• Each state can be a set of fragments that are active

• Allows easy reordering of fragments

Other AI

• Messaging – This is a good way to keep track of game data in the

controller class without using a lot of processing time – Used to trigger rule system

• Scripting– Can abstract out code for messaging, switching and

ordering– Helpful for doing replays

Camera angles in replays

• Important for sports games • Give the player the ability to see some of

the minor details of the game• Common problems • Different styles

Problems

• Player must be entertained continuously

• Frustration – Accuracy (use better recording schemes )– Poor performance– Player must feel in control of the replay

• Restart, pause, speed control, jump forward and back, and change camera

More problems

• Boredom

– Have a fast paced interesting replay – This is hard to do because you need to create

the replay on the fly – A rule based AI system can help in this– These rules can be based on film making

camera work

Different styles

• Intro Camera– Introduces you to the stage and actors – Starts at a distance and then moves toward

the subject– When it get to the subject circle around the

subject– Only used at the beginning when everything is

stationary

First person camera

• Presents the stage from the subject’s point of view

• Useful in racing games • Important to have a frame of reference on

the subject• Can be used often but for only short

periods of time

Follow or Third-person camera

• Shows part of the scene and the subject from behind

• Many variations of this camera from different heights and distances

• Used as a calming section after an action sequence

• This camera can be used for up to 50% of the replay

Matrix camera

• Pauses some or all the action and then circles around the subject

• This gives a very dramatic effect

• Should be used when something spectacular is happening

• Use this camera very sparingly

Circle camera

• Slowly circles the subject while looking at them

• Good for a slow portion of the replay

• Can be used as a transition from side to side of the player

Still frame camera

• As the subject passes, the action is paused at regular intervals simulating photographs

• Used in conjunction with photographers on the sidelines

Camera switching rules

• Don’t cut to the opposite side of a player it is disorienting

• Subject should always be in sight• Transitions from camera to camera should

be fluid • Special cameras (matrix) should be used

sparingly

Camera Switching rules cont…

• Use follow cameras a lot to serve as breathers between other cameras

• All cameras should know where to switch to in case they lose sight of the subject

• Make sure the camera types used are appropriate for the game type

Some good tools

• Switching the subject of each camera • Taking screen shots • Stop subject while the rest of the scene

continues • See and change what camera the current

camera is going to switch to• Tools to allow an artist or designer to fine

tune the replays

Freak Out - Extreme Freeride

• Snow boarding sports replay

• Shows examples of the different kinds of cameras

• http://www.youtube.com/watch?v=Axwy2j2E84M

Super Mario Galaxy

• Good camera implementation

• A lot of open field areas without many obstacles

• www.youtube.com/watch?v=v7bN-YhEEtI

Legend of Zelda: ocarina of time

• Boss battle with terrible camera implementation

• http://www.youtube.com/watch?v=ef4z7SQi5Oc