Rigidbody over network, what are the options

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?

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.

Thanks for the reply. How is unet treating you? I am hearing that the documentation and support is not the best

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.

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.

1 Like

Man that sounds horrible. Have you considered other frameworks?

No. Just holding out.

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 :slight_smile:

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

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

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](http:// Unity Asset Store - The Best Assets for Game Making) if you use UNET.

For networked physics. I suggest looking at this article. It talks about a few different ways to Network physics that are very helpful.

1 Like