Skip to main content
gamedev.net
🔒 Locked

Design issue: camera

Started by Trip99 Dec 23, 2004 at 6:44 AM 4 replies 850+ views
Original Post
Trip99
Trip99
Hi, in my design structure I have a Visualisation component responsible for rendering the world - it is a black box library component and could be a Direct3D or OpenGL implementation etc. I also have a world component that keeps the current state of all entities within my fictitional game world. You could also call these components simulation and visualisation. Now deciding where items should go between these two is normally easy but I am not so sure when it comes to the camera: - The camera implementation is specific to the Visualisation component. - The camera update is handled by the world component - Camera movement/rotation is set by an external UI that provides continuous values - In a FPS the camera is controlled (or controls) the position of the player entity in the world. So I wondered how you handle your cameras?
------------------------See my games programming site at: www.toymaker.info
Puzzler183
Puzzler183
I let my GUI system control the view port, and make the camera and object that can, if the programmer desires, be manipulated by the physics engine. I have a seperate lens class with a bunch of standard stock lenses to hand my field of view issues.
JohnBolton
JohnBolton
It's simple -- the two cameras are not the same thing. You maintain a camera object in the simulation component, and use it's position and orientation (and perhaps other properties) to configure the visualization component's camera.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Trip99
Trip99
Good point and something I should have thought of :) Thanks.
------------------------See my games programming site at: www.toymaker.info
DrGUI
DrGUI
When developing my cameras for my game Rock Paper Scissors, I implemented a camera base which contained the basic functions like forward, right, up vectors, orientation, position and the projection properties etc. I then derived a camera that worked with yaw, pitch and roll angles which provides the implementation (updating all the matrices is based on a dirty flag system, which I feel quite proud of).
Separately, I have camera controllers which reference the camera - and this provides great flexibility. They can be easily switched as well, like for the developer camera where you can move around, the normal camera and the chasing camera effects during the game.

With this, the camera properties and the controllers would be part of your state and the camera state (CameraBase in my example) would be used by the Visualisation component to render from that point.

Hope that helps,
Magnus Wootton
Magnus Wootton
theres one camera per instance of your black box. this is your main camera
that the gamer sees and renders the world. if you have extra cameras on top of
this notably used for dukenukem cameras then youll need a camera per rendertarget, its basicly camera per rendertarget. all these cams simply have
up,right,forwards and position, thats it.
then your game world can have cameras that swap between each other depending on
which one is active at the time, these cameras could index one of the duke nukem cams or the main blackbox cam. these cameras can have all the fancy stuff
in em, like movement etc.
in 2 sections, just like you wanted.
its all straight c object systems.
stop picking your nose

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.