1bytecharhaterxxx
1bytecharhaterxxx

Reputation: 1

How are camera views handled in fps multiplayer games?

Hi I was completing the movement system in my hobby engine, where I have a fps camera, and I was curious to know how multiplayer games handle the movement of all players, I mean imagine there are 10 people on a server,8 players playing and moving,2 spectating, do they have 10 different cameras with the mouse movement of each player right? Or am I missing something? So for example if I die and I wanna switch my camera to another player that is playing I simply switch my view with his view? Does it make sense?

Upvotes: 0

Views: 266

Answers (1)

user369070
user369070

Reputation: 635

Here's a great resource for coordinate systems, transformations

The camera is just a matrix(or a combination), that bends the universe into a single box(what happens to be outside is outside of field of view) by multiplying coordinates of triangles by self, which is then drawn as if its xy corners were the the corners of screen(viewport actually), and z is the depth(if you need it).

Just 16 numbers, 4x4 matrix is passed to the rendering engine(or more, if you pass view and projection matrices separately), that puts the triangles where they end up on the screen. In my own engine, I pre-multiply the view matrix (one that rotates and shifts the coordinates so the camera is the origin, 0;0;0 point, to the view space) and projection matrix (one that packs things in field of view to the screen-box, clip space).

Obviously, if you want a different camera, you just make the matrices from the camera's position, orientation, FoV, etc.

Upvotes: 0

Related Questions