Game Camera
Game Camera
Camera Types
1. Fixed Point: A fixed point camera neither moves, scrolls nor rotates. Many simple games like
Tetris or Bejewelled use one fixed point. Larger games like Jet Set Willy use a series of fixed point
cameras, one for each room. Adventure games like Blade Runner also use some fixed point
cameras, but the perspective differs from scene to scene.
2. Rotating: A rotating camera is unable to move or scroll but it can turn. Adventure, platform and
survival horror games sometimes use rotating cameras for especially grand rooms. An alternative
use is for tight spaces in some otherwise tracking-based games (see below), or for special modes.
3. Scrolling: The game world is a flat two dimensional grid and the scrolling camera moves on a
plane parallel to it. Scrolling cameras can move horizontally, vertically, or both depending on the
game. Many 8-bit and 16-bit platform games use scrolling cameras, as do shooters.
4. Movable: Sim and strategy games often use a movable camera. The player looks down from
overhead and moves the camera around the world using arrow keys or the mouse. Some games, like
World of Goo or Angry Birds, use the same kind of camera but look from the side rather than
above.
5. Floating: Floating cameras are movable cameras with no fixed orientation. The floating camera
adds rotational control allowing full 3D navigation. The Total War games, Black and White and the
Homeworld games use floating cameras.
6. Tracking: This camera tracks the doll along a pre-defined line in 3D space. It may rotate, speed
up or slow down, fall behind or even move ahead of the doll as required but the player has little or
no control over its movements. Tracking cameras are often used in linear action or platform games
like God of War or the Kim Possible DS games.
7. Pushable: Pushable cameras occupy a default position (usually behind the doll) when not
controlled, but the player can push them using a second thumb stick or mouse. The camera then
rotates around the doll. This kind of camera is very common in modern games. Pushable and
tracking cameras are often casually grouped as ‘third person’ perspective.
8. First Person: First person perspective combines the camera and the doll, which means the player
sees through the doll’s eyes. He uses one set of controls to move the doll’s body and another to turn
its head. One limited variant of first person perspective is the bonnet camera in some racing games.
Another is sniper mode, where the player can aim but not move (or not move well).
THE THREE Cs OF GAME DEVELOPMENT
When you make a game, keep in mind the three Cs of game development:
1. camera,
2. character, and
3. control.
• These three Cs act as the player’s main introduction into the world that you hope to create.
• They’re the only aspects of your game that your player will always be dealing with.
• When you understand the role of each of these three Cs in your game, you’ll better
understand not only your game, but all games that you create or play.
CAMERA
• The camera is the player’s window into your game. It’s what the player sees and responds
to. Camera placement in a game is vital because the player’s basic understanding of your
game world will come through the camera.
• Changing the location of the camera can change the entire feeling of the scene or, in some
cases, break the scene entirely.
• Your game camera should be treated in much the same way as a film camera. The problem is
that, in games, you can’t always control where the player (or camera) goes.
• When you create your camera, you have to decide how much control you want your player
to have over the camera and whether you’ll limit that control in any way.
• Cameras that players have complete control over or that players can rotate reveal to the
player information from all over the world
CHARACTER
CONTROL
• Control is how your player interacts with the game.
• The thing that separates games from every other type of entertainment medium is their
unique ability to engage with an audience.
• Players don’t just read or watch the events play out as they do with books, movies, or TV
shows.
• They play an active role in the experience and are invested in the characters because they are
the characters.
• Controls make or break a game. A game with a poor control setup will never engage players
on the same level as one with good controls, no matter how good the graphics or story is.
• You play games because they make you feel in control, so when you design your game, you
have to think about how controls interact with the player and how you can make the game
accessible for the greatest number of people or example, when you think about movement in
a computer game, what buttons do you think of?
• Probably the W, A, S, and D keys. But why? Why don’t gamed designers use the 6, Caps
Lock, Enter, and Spacebar keys instead? After all, those keys also relate to the different
directions.
• The reason designers typically use W, A, S, and D is because they don’t want the player to
have to put a lot of effort into playing the game for each desired effect.
• If you have to move your hand too much, or stop and think about the controls, that can break
your immersion in the game, which kills it.
Step 5.1
package com.embu.gamedev.window;
import com.embu.gamedev.framework.GameObject;
public class Camera {
private float x, y;
Step 5.2
Camera cam;
}
}
Graphics2D g2d=(Graphics2D)g;
g2d.translate(cam.getX(),cam.getY()); //Start
g2d.translate(-cam.getX(),cam.getY()); //end
Step 5.3
package com.embu.gamedev.window;
import java.awt.*;
import java.awt.image.BufferStrategy;
import java.util.Random;
import com.embu.gamedev.framework.GameObject;
import com.embu.gamedev.framework.KeyInput;
import com.embu.gamedev.framework.ObjectId;
import com.embu.gamedev.objects.Block;
import com.embu.gamedev.objects.Player;
Handler handler;
Camera cam;
if (running)
return;
running = true;
Thread thread = new Thread(this);
thread.start();
init();
this.requestFocus();
}
}
Graphics g = bs.getDrawGraphics();
Graphics2D g2d = (Graphics2D) g;
g.setColor(Color.black);
g.fillRect(0, 0, getWidth(), getHeight());
g2d.translate(cam.getX(), cam.getY()); // Start
handler.render(g);
g2d.translate(-cam.getX(), cam.getY()); // end
g.dispose();
bs.show();
}
public static void main(String args[]) {
new Window(800, 600, "Embu Games Prototype", new Game());
}
}
Step 5.4
We can now test the Camera by updating the tick() method in Camera class as
below
package com.embu.gamedev.window;
import com.embu.gamedev.framework.GameObject;
private float x, y;
When you execute the project our screen will start to move to the left.