I wonder how people is handling Join in Progress in multiplayer games using UE4.
Imagine the following scenario:
Game starts
Client A joins
Client A picks up an item, which is added to Client A by a NetMulticast function which runs on every connected machine and Attaches the Item to the actor controlled by Client A
Client B joins
Client B sees Client A without the item
Client A drops and picks up item
Client B sees the item in Client A hands
How to handle the item attachment on Join in Progress players?
Another scenario:
Game starts
Client A joins
Client A changes replicated variable value, for example a bool bIsProne to true, any other Client connected receives this and see Client A prone
Client B connects
Client B does not see Client A as prone
Client A un-prones and then prones again
Client B sees client A prone
Any suggestion on how to handle such situations?
Thanks in advance.
RPC functions should only be called for cosmetics really. If you use replication of variables properly, and use the OnRep functionality for any other visual gizmos, there should be no problems. In your first example, if B joins after A has picked up the item, the fact that A has the item should be replicated to B automatically.
All replicate values on the server get replicated to the client when he joins, so yes, he will always receive the latest state of the game. If any of the replicated variables change again, they will also be updated on the replicated client.