How to make FPSCamera system work over network?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
SirSami
Posts: 20
Joined: Mon Mar 24, 2008 2:18 pm
Location: Finland

How to make FPSCamera system work over network?

Post by SirSami »

I've been wondered how to to make FPS game camera system work over network. The collisions are happening at the server side and server cares about player position. But the rotation of the players is the problem. I've been thought many different ways to make it and I don't have any good idea for that. Server has to know player rotation so it can send them to other clients. Is it possible way to do camera system like that: Client sends a camera rotation to server -> Server sends camera rotation to all other players so other clients know the rotation. Is there something what I have to notice about collisions? And by the way, is it possible to get camera rotation?

Thx for the help ;)
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sure, that sounds workable.

What you send depends on what you mean by 'rotation'. Cameras have a direction vector and an up vector. You can retrieve them simply with:

Code: Select all

vector3df direction = (camera->getTarget() - camera->getAbsolutePosition()).normalize();

camera->getUpVector();
If you actually want the rotations, then it depends on how many axes you need:

Code: Select all

// Gets X and Y rotations (i.e. pitch and yaw)
vector3df cameraRotations = direction.getHorizontalAngle();
If you need Z (roll), eh, we'll cross that bridge when we come to it.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply