• Welcome to Valhalla Legends Archive.
 

Position/Rotation updates

Started by TheMinistered, November 20, 2004, 11:16 PM

Previous topic - Next topic

TheMinistered

I need to relay player position/rotation to all the other players.  I need to figure out the best/optimal way to do this.

I thought about using a lerp method, in laymen's terms a prediction method, for position.  I basically send a lerp start, which includes my direction and which way I'm moving, and all the other players will keep moving the player in that direction until it receives a lerp end.

I have no idea how to optimally send rotation updates.  The only way I see fit is to send them every time the rotation changes, which could be thousands of time per second when rotating.

Can anyone suggest any methods/algorithms for doing this?

Arta

How about initialising the state with a message saying where everyone is, and then a message just stating a destination when something moves? I think the same thing could work for rotation, IE, A message saying "I'm going to rotate clockwise by 46 degrees over 1500ms" And then everyone else can figure out the intermediate steps.

Banana fanna fo fanna

That obviously won't work, Arta. If you want a real-time game, we don't know when the player will stop moving.

TheMinistered, that sounds like a good idea. You're going to have to watch out for the lerp end, though. If you don't get it right, you'll have the player "snap back" a few degrees.

TheMinistered

The position and rotation vectors are both 12 bytes each.  I can send the entire position packet (12) and the rotation y (4).  That puts me at 16 bytes + 3 bytes (header) -- 19 bytes per packet.

I was thinking about just sending position/rotation updates every 50 ms.  That means that I'll be sending out 380bps and receiving 380bps from each player.  Now lets say we have 32 players that I'm receiving data from -- that's 11.8kbps.  I think this is obviously unacceptable.
I could use a mix of the two though!  I could use a lerp to move the characters when they're not rotating at all-- then use position/rotation updates every 50ms when they are rotating...

Thus when players are rotating i'll be receiving 380bps from each player, but when they're just walking bandwidth usage will be very minimal! :P

Kp

You could also trim bandwidth consumption by doing some adaptations to frequency of sends when you are rotating.  For instance, if the user is on a low bandwidth link, have the option to reduce frequency of sends (with the realism cost of snapbacks and such, but the gain of not killing the link).  Whether the app autodetects such a link or just requires the user to indicate it is your decision, but it could make a difference for players who have trouble keeping up during rotations.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Eibro

Could you not interpolate the rotation as well?
I'm rotating clockwise.
I've stopped rotating clockwise.
Eibro of Yeti Lovers.

TheMinistered

well, position moves at a constant speed so you can "predict" that.  However, rotation's speed is variable based on how fast the user moves his mouse.

Eibro

Quote from: TheMinistered on November 21, 2004, 02:50 PM
well, position moves at a constant speed so you can "predict" that.  However, rotation's speed is variable based on how fast the user moves his mouse.
Send it as a vector, then.
Eibro of Yeti Lovers.

Arta

Quote from: Banana fanna fo fanna on November 21, 2004, 08:39 AM
That obviously won't work, Arta.

He didn't say anything about that, and what's to stop him from having a 'stop early' message?