RPC call in Update

Hello guys,

I am trying to convert DragRigidBody.js for a networked version. Now, the whole grabbing and dragging is in the Update function. I’ve put

networkView.RPC… in the update function but

it affects the overall result avoiding any grab. So I was wondering, is it allowed to put the NetworkView.RCP() into the update?

Cheers,
GC :slight_smile:

Yes its allowed but not reasonable as you will never send events with < 5ms latency so it will stack up to the point where the computer shuts down any networking completely.

you best check the state at descrete points (all 16ms++) and send it then so you don’t overflood.

I assume other users can’t move it, right? if you have players on all sides move it, you will end with a more or less completely unpredictable state

Well,

the other players are allowed to move, the real owner is the server. So that’s why I try to notice the server that a client picked up an object and is moving it. I am trying to convert the DragRigidBody.js and the drag grab happens in the update :frowning:

GC.

The problem is that the drag rigidbody is for a single user, it won’t resolve concurrency so the state will differ on each machine.

What you would need to do is send the RPC to the server only and have the server syncronize the rigidbody position etc to the client at very least.

Even better would be a handling similar to how the Networking Example works with a setback of events when sending it around so you can take latency into account too, which will otherwise definitely cause a total messup (generally simulated physics is not really networking friendly)

Thanks dreamora,

that’s exactly what I am experiencing. But the project needs clients moving the objects. What I am trying to do is axactly sending the RPC to the server which owns the objects (all networked.Instantiate -ed) and if the server moves the objects all it’s fine, but when a client moves an object … well… I still can’t figure what I should send to the server. An authoritative server seems suitable, in accordance with the MH Network Example Tutorrial 3, but still , is not really the same as I am not dealing with Player joining the network but with objects inserted by clients through the server.

GC.