How to make sure an actor has finished replicating over the network after server side spawn&initialization?
I am implementing a turn based strategy, in which players can control and give orders to a squad of units (characters). Therefore the player controllers should be able to manage multiple character controllers.
Within a player controller I need a way of accessing client side character instances this player controller manages so that I can display unit information (health etc) on the heads up display.
I thought that the easiest way to do this is to let all GameState instances collect the replicated character data by querrying all actors in the world and cache them within an efficient data structure. This is supposed to be done only once when the game begins.
However the time when I do this caching is important. For instance if some of the actors are yet to be spawned on the client side that means the caching on this client's GameState will fail.
When GameState caching is complete, GameStates can then answer client side querries about these characters efficiently (with minimal search). My characters and players are already set to replicate their data over the network. So their internal information will be kept up to date.
This is what I have in mind as a solution. To do this hoverer, I need to make sure that all characters are safely replicated over the network (they have their copies on client machines) and also their initial data is setup correctly (host initializes them after the actor spawn routine).
Is there a way of putting a barrier on host side initialization routin (within my custom GameMode) such that it waits until all characters and players are spawned, replicated and initialized safely all over the network, so that it can call a Multi Cast RPC on all GameStates to begin their caching?
I can of course put a small delay here via timer but I consider this as an inefficient hack.
As a C++ programmer I have zero experience on Unreal networking. And I find it really hard to find some good network implementation tutorials (on C++ side) except the very trivial ones.
Any help will be greatly appreciated.
Follow this question
Once you sign in you will be able to subscribe for any updates here