best way to send angle

Posted By: MPQ

best way to send angle - 04/21/13 19:17

Hi guys,

got the follwing problem. I am using the "mouse_force" variable to change players angle. Since I rotate my entities on the clients seperately I send the "mouse_force" value from the client (which is movin the mouse) to the server and then from the server to the other clients. This procedure needs a lot of bandwidth. Is there any better way to archive the same result with less bps?

Thanks
Posted By: lemming

Re: best way to send angle - 04/23/13 14:04

How often do you send it?
You could wait on the server til the pan changes significant and then send the pan to the clients. Then you wait til it changes again significant. About 5 or 10 degree, you have to try different values. But make sure to do smooth rotations on the clients, or they will notice.
Posted By: Ch40zzC0d3r

Re: best way to send angle - 04/23/13 14:39

ok how I do it in my FPS game:
1. Round the angle (use integer(urVar) to check), only send pan and tilt
2. If the result of the substractio is too big, send the new angle
3. Send in UDP mode, so you save much more packets for the TCP mode (Save bandwidth)
4. Lerp between the new anf old angle
Posted By: WretchedSid

Re: best way to send angle - 04/23/13 15:44

You can sufficiently send yaw and pitch using two 16 bit integers, instead of a full blown 32bit integer/fixed point. You are also left with an additional 7 bits per integer (assuming you use a value of 0-360), which means that you can pack additional torque data for the angle into it (use 0x168 or 0x7F to mask out either the angle or the torque).
The torque data can be used for dead reckoning to lower the frequency you have to send packages. Like Chaoscoder said, use UDP and allow the packets to be dropped and send every few time intervals (seconds, depending on your needs), a reliable package to synchronize the orientation of the character.
Posted By: MPQ

Re: best way to send angle - 04/26/13 09:13

thanks guys! I am gonna try out your ideas
© 2024 lite-C Forums