Replication happening too slow, even with ForceNetUpdate

// IsTagged is a replicated variable
myPlayerState->IsTagged = true;
myPlayerState->ForceNetUpdate();
// NetMulticast function
myCharacter->OnPlayerStateUpdated();

// so we set IsTagged true and it is replicated eventually, 
// we then have all clients' versions of the replicated character check its latest state
// which should be IsTagged = true, but it's not until after the OnPlayerStateUpdated event happens

void GameCharacter::OnPlayerStateUpdated_Implementation()
{
    if (Role != ROLE_Authority)
         check(myPlayerState->IsTagged);
}

Well I went ahead and ‘solved’ this by making the variable not replicated by the engine but instead by reliable RPC.

Okay, my old solution wasn’t really correct. The correct solution is to have things occur when the variable changes for the client. The reason I was sending an RPC after setting a replicated variable was to let the client know stuff had changed, and the reason I was doing that and not OnRep was because I was letting the Controller know that the PlayerState had changed (or really, was going to change) since I already was referencing the controller. I restrategized and moved state stuff that the controller was dependent on out of player state and into the controller. The player state doesn’t need to update that quickly, but the controller does.

Yeah, your approach wasn’t correct. You should have either used an OnRep on the player state that called the function on your character or used an RPC. There’s no guarantee that a variable and RPC will happen in order

I’m not sure if this is the same problem you had but they sound similar. In my case I made a custom PlayerState class and added a “points” replicated variable (since score is read only for some odd reason… but that’s a whole seperate issue)

so i bound a key to make a server call to add 50 points everytime i pressed it. And i was drawing the value on the hud every frame yet I noticed the points updating seemed extremely laggy.

Turns out while most actors have replication “Net Update Frequency” of 100 times per second PlayerState is set to 1 update per second.

I just bumped PlayerState Net Update Frequency to 100 and everything worked exactly as i wanted. The down side is you may be replicating things like small changes in players ping needlessly as that’s something you would probably only want sent like once per second.

So when all is said and done, Due to the constantly changing ping values and because I think in most cases player scores don’t need to be updated more than once a second I think it’s a good idea to leave PlayerState at 1 update per second and put values you need updated more quickly somewhere else.

I just ran into this exact issue. Thanks for helping me narrow it down! However, I noticed that a probably better solution to this is to call a “Force Net Update” node (if using BP. There’s most likely a c++ equivalent) right after you set the new score variable.