Synchronize creating weapon entity while throwing animation

Options
Hi! Did somebody face with the task to realise throwing network synced weapon? I'm trying to do this last few days. There is 2 main ways : create on server 2nd(double to current in hand weapon) weapon and then apply force to it, or set SetTransform to current weapon, unparent it from hand (parent = null) and apply force. In both ways i can't handle network lag toward animation speed. You can see it in video.

1 way : 1st also can't be realise cause when you detatch weapon from parent(hand),weapon changes it's own world position(even with SetParent(null, true) ). So you need cache it before and then apply to weapon weapon.transform.position = cachePosition. On clocal side this looks ok, but for other client weapon will glitch at 1 frame (video https://www.youtube.com/watch?v=syK64qCHpJY)

2 way : In this case i create networked weapon in Animation event. You can see significant lag. (https://www.youtube.com/watch?v=bN6qUZfdwCQ)

3 way : In this case i also create networked weapon on server but in animation event make pause for few frames and then apply force to weapon. You can see dissynchronization of current weapon and just created networked. (https://www.youtube.com/watch?v=4a8Wvy2WfRQ)

4 way: I create netwokred weapon at the beggining of throwing animation, and in the moment of throwing(on animation event) slow speed to 0.5f, envoke event to sync throwing networkjed weapon with curretn weapon and apply force, then disable current. Lag is also exist (https://www.youtube.com/watch?v=DzAQGPEJhJE)

Weapon has interpolation Bolt algorithm (space : local). I've tried extrapolitaion, network rate == 1. And result was the same.
I hope that you can advice me how to solve this problem.

Comments

  • Jon Bonne
    Options
    I'm not sure if this addresses your problem, but others have created a second "fake" weapon that is visible to the local player only. It is launched at the correct time with its own local-only physics. You then interpolate the fake weapon's position with the server weapon's position over time until they are in sync. The syncing up is done slowly as the weapon travels through the air.