What is the best way to achive initial world state replication for client after connecting to the server?
So, for example I have replicated static mesh on dedicated server.
Client joins the server and moves mesh to another position. After few minutes another client joins server. He will see mesh in initial position (not moved) - and it is wrong for game logic.
Of course when mesh will moved again - it will replicate its state to all clients, but it is too old.
So, what is the best way to achive initial on-connect world replication?
I have the same question. The only way I can think of solving this is by creating a ‘on join’ custom event for every single actor that has replication.
How is this done in UE4? What is the correct or recommended design pattern? I don’t mind writing my own code, but it would be great to have some validation on the direction.
Also it is possible to create events in PlayerController (with execute on owning client settings). And on login client will send event to server, server collect all mesh positions and send back to client…
After doing a bit of digging I was able to find a page in the documentation that handles just such an issue. I have provided a link below. I hope that this information helps.
Link: Content Examples Sample Project for Unreal Engine | Unreal Engine 5.1 Documentation
Make it a great day
The chest example is an exact match for my issue. I was looking for terms like “deferred callback”. My only criticism is that the SEO for some of these concepts are too ambiguous. As with many things, it is not a lack of understanding how to do it, but a lack of knowing how the engine does it. I would have never thought to look for “relevancy” in the context of the technical problem. Thank you for the answer!