[Question] Initial Game State Replication

Is there an inbuilt way of determining, on a client, when a server has finished it’s initial full state replication to the client. So the game state, player state, controller, any player pawns, all world actors, etc. are fully replicated and available for use?

I don’t believe we have any one function in the engine that is called when the client is “fully initialized”. It’s typical to check for the existence of those objects on the client and wait until you have them all depending on what data is required.

Each class has its own nuances.

Maybe if we start with a higher level question of what you’re trying to do?

Yeah, that’s what I’m doing now. Checking if each of the objects exist and, when they finally all do, running some UI init code, which requires those actors. I was just wondering if there was an easier way :slight_smile:

I also have some code in the PostInitializeComponents method on some actors that I need to move. I had, mistakenly, assumed it would replicate the initial game state before running things on the client (why doesn’t it?)

I’m going to continue the check for those actors (game/player state, controller, hud and pawn) and then do a level-wide “hey, we have liftoff” broadcast to any actor that needs it once they are all set (I have some actors that interact with the player and game states, and the ui, on the client side.)

That does leave some actors, which might be replicated after that broadcast, in the lurch a bit. Is there a “I’ve been created through replicated” event on actors anywhere? I see the PreReplication method, which I assume runs on the server, but nothing for the client side. I want some of them to register themselves with the UI when they are replicated. I’d love an event I can trigger that in! Do the PostActorCreated or PostSpawnInitialize methods run on the client after an actor is created through replication?

PostNetInit seems to be a good candidate!

PostNetInit is per AActor, and BeginPlay is called on every new AActor once the world has “begun play”, but there are caveats there too.
There is no “everything is ready” type call.

Checking for all your variables on a timer on the PlayerController (every N frames) and then calling your code and stopping the timer, might be a decent way to do it.

Okay, thanks for the replies!