Network synchronization

I have a simple example:


/
/

There is a replicated actor. There is also a replicated variable Collision Enabled using Repnotify. In the repnotify implementation, I simply turn off physics and collision. By default, the actor has physics and collision enabled. On a custom key, I take an instance of the replicated actor class from the stage, set the replicated variable and attach it to the actor. Everything is fine on the server, but on the client the actor is not attached. If I put a delay between setting the replicated variable and attaching, then everything works. Problem: On the client side, the repnotify call occurs later than the attachment. Although I call repnotify first, and then attachment. Why is this happening? And how to solve? Perhaps there is another way of what I want to do?

That happen because server and client are different machines… one could be in China, and the other could be in USA…

You can’t modify network velocity…

That does’t work really… you never know how much time take to complete.

Use a timer and check it while… or change your logic.

That’s not the point at all. Even if the other computer were on another planet. There must be a sequence in which packets are sent. And I don’t understand how it works in the unreal based on the example.

it works like threads (parallel process) … simply is asynchronous

It’s all bundled into a single packet.

Image 1 logic should only happen on the server.

input (3) β†’ switch has authority (Remote) β†’ RPC server

Server RPC β†’ get actors β†’ set is collision enabled β†’ Attach

Net Actor BP should have β€œReplicates” ticked true.

1 Like