Author | Message | Time |
---|---|---|
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? | November 21, 2004, 5:16 AM |
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. | November 21, 2004, 11:16 AM |
St0rm.iD | 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. | November 21, 2004, 2:39 PM |
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 | November 21, 2004, 4:36 PM |
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. | November 21, 2004, 5:45 PM |
Eibro | Could you not interpolate the rotation as well? I'm rotating clockwise. I've stopped rotating clockwise. | November 21, 2004, 5:53 PM |
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. | November 21, 2004, 8:50 PM |
Eibro | [quote author=TheMinistered link=topic=9627.msg89648#msg89648 date=1101070249] 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. [/quote]Send it as a vector, then. | November 21, 2004, 9:23 PM |
Arta | [quote author=Banana fanna fo fanna link=topic=9627.msg89613#msg89613 date=1101047997] That obviously won't work, Arta. [/quote] He didn't say anything about that, and what's to stop him from having a 'stop early' message? | November 22, 2004, 12:56 AM |