Ywa Posted February 2, 2012 Share Posted February 2, 2012 Hi everyone, I was wondering. What's the best way to fully control a controller entity? My current server is like this (multiplayer environment): Client A walks arounds the map and utilizes the UpdateController function. Every 10 frames, the position, rotation, velocity and omega are read out and send to the server. Which also has a controller (without updating) and sets the 4 vectors. However, the problem is that when I read out the rotation values every frame. If in the same frame the 4 vectors are set on the server (by the networking), the values are correct (makes sense), however, when reading out the values when not being set, they always return something between -1 and 0 (usually 0). I tried to store the Y-angle/rotation in a separate variable (on the server) and call this every frame (no movement): UpdateController(self.Entity,fControllerAngleY,0.0,0.0,0,40,1,0); It does fix the 0-rotation problem, however, things are not smooth at all. So is there a way to simulate the velocity, rotation etc. Without actually calling UpdateController? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Naughty Alien Posted February 3, 2012 Share Posted February 3, 2012 ..all transformations and way they suppose to behave (smooth turning, etc etc), regarding controller, should be done before actual UpdateController call.. Quote Link to comment Share on other sites More sharing options...
Ywa Posted February 3, 2012 Author Share Posted February 3, 2012 ..all transformations and way they suppose to behave (smooth turning, etc etc), regarding controller, should be done before actual UpdateController call.. I'm setting the position, rotation, velocity and omega before calling it. But it seems to slow it down because UpdateController is called with 0 speed. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted February 3, 2012 Share Posted February 3, 2012 This is fascinating to me. I plan on implementing some similar functionality, just haven't gotten to it, so I love to pick the brains of those doing it ahead of me. Why are you not calling UpdateController on the server with the velocity that you passed it from the client? What do you mean "things are not smooth at all"? The first thought I had was that you are not taking into account network latency. rotation_on_server = rotation_on_client + omega_on_client * network_latency Quote Link to comment Share on other sites More sharing options...
Ywa Posted February 3, 2012 Author Share Posted February 3, 2012 Well, when I sync props/phys-objects using the same way (pos, rotation, velocity, omega) things are very smooth. And I didn't mean network lag anyways. What I meant was it seems the player was slowing down on the server (and thus other clients too). In the past I used a simple barrel as player-model (and only used the controller @ the local player). And everything was perfect, because there was no controller at server + other controllers screwing things up. Quote Link to comment Share on other sites More sharing options...
Clackdor Posted February 3, 2012 Share Posted February 3, 2012 Are you calling UpdateController every frame? Or only when you receive info from the Client? You should call UpdateController everyframe with information received from or extrapolated from info received from the client every frame, even if that info is only updated every 10. Quote Link to comment Share on other sites More sharing options...
Ywa Posted February 3, 2012 Author Share Posted February 3, 2012 The whole problem is that I don't want to call it. I just did it an attempt to work-around the problem. It's simple. I want to simulate the movement the client calculates. I decided to use a controller on the server too because they have the same shape then. If I give the server an oildrum physics file and the client the real controller, there's no possibility it would ever work properly, unless their physics collisions are the same. I better just stick to this question now: Is there a way to give the controller physics shape to a non-controller entity? Quote Link to comment Share on other sites More sharing options...
Clackdor Posted February 3, 2012 Share Posted February 3, 2012 Pass the radius and height of the controller to the server and create a body? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.