Search Unity

Rigidbody over network, what are the options

Discussion in 'Multiplayer' started by CGPepper, Apr 18, 2017.

  1. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    152
    I am working on a VR hockey game where the puck moves as a rigidbody, naturally colliding with the hockey stick. Because of the nature of the game, the puck tracking should be very precise.

    As far as i understand, it is not possible to step through the physics interactions in unity.
    Photon TrueSync does solve this problem with its own physics engine. But it doesn't support drop-in, drop-out players i believe.
    Other physics engines like bullet, could also work, but i've heard that its horribly documented and is very hard to work with.

    What other options are there?
     
  2. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    651
    I have used NetworkMessages to code up a rigidbody UNET syncing script. It's not perfect, but works OK.


    With the messages
    Server --> All clients (for server authority)
    Client -- > Server --> Other clients (for client authority)

    I periodically send information such as position, rotation, velocity (and for characters I also send commanded velocity and angle so that acceleration/deceleration can be performed locally on each client in-between network updates). I also detach the visual mesh renderer from the Rigidbody and LERP it to make it look smoother even though the rigidbody is actually being snapped when it receives the network update.

    Again this works OK, but not 100% perfect (see video). I think I may need to buffer these network receive packets and apply them during FixedUpdate instead of Update... but I'm not sure.

    Anyhow you could try something like this. Good luck.
     
  3. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    152
    Thanks for the reply. How is unet treating you? I am hearing that the documentation and support is not the best

     
  4. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    651
    UNET has been a real struggle. The HLAPI is so buggy/broken I can't work around it. I've ended up gutting all HLAPI. I bug report, and Unity QA replicates, but I haven't seen any fixes since SeanR left.

    At the moment MessageBase is the only UNET feature I use because literally *everything* I've used is broken (SyncVars broken, SyncList broken, ClientRPC broken, NetworkAnimator is broken, NetworkTransform is jittery, NetworkBehaviour design is fundamentally issues like not being able to send data in 2 directions from client --> server and server --> client, Command inheritance bugs, Animator interactions). Here's a list I've been keeping.
    https://forum.unity3d.com/threads/my-compiled-list-of-unet-bugs-issues.403578/

    So my advice would be to only use MessageBase, nothing else. Not until it gets fixed up.

    UNET has been my biggest timesink and frustration. I'm glad to hear they are putting 2 more staff members on the HLAPI though... I think UNET will be good once things get cleaned up.
     
    marcV2g likes this.
  5. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    152
    Man that sounds horrible. Have you considered other frameworks?
     
  6. Zullar

    Zullar

    Joined:
    May 21, 2013
    Posts:
    651
    No. Just holding out.
     
  7. josteos

    josteos

    Joined:
    May 12, 2017
    Posts:
    4
    I've also got a physics-based VR hockey game bubbling around, and I've also got some multiplayer working, and I'm guessing we're in the same boat re: multiplayer physics.

    Did you get a working hockey solution? I'm currently using Photon, but threads like these are making me reconsider :)
     
  8. CGPepper

    CGPepper

    Joined:
    Jan 28, 2013
    Posts:
    152
    I did not, decided to stay away from the multiplayer until physics sync has a decent solution. Just doing leaderboards.

    Do you have any vid of your project? Anything hockey VR makes my spider senses tingle
     
  9. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    At that point you might as well just use the LLAPI (NetworkTransport), which works great. And as a bonus, you can structure everything exactly the way you want it to be
     
    Last edited: May 12, 2017
  10. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    589
    Unity's Network Transform wasn't really cutting it for us. I ended up adding a buffer of states in the past and also step through future physics like you say. You can check it out here if you use UNET.
     
  11. TwoTen

    TwoTen

    Joined:
    May 25, 2016
    Posts:
    1,168
    mysticfall likes this.