i have a zombie killing game and inside the character BP there is a variable called ZombiesKilled which, well stores the amount of zombies killed by the player and then is replicated so the other players know how many kills you have
should i start using the blueprint Player State instead of doing this inside my character BP? what are the pros and cons?
asked Aug 29 '18 at 09:56 PM in Blueprint Scripting
First off, if you plan to re-spawn the character (destroy and re-spawn) or posses another pawn (spectate or enter a vehicle) you will loose your score so you may be tempted to move the zombiesKilled in the PlayerController...
But... If you move to the PlayerController (it is replicated) you will have a problem because although the server has instances of all PlayerControllers, each client only has his own PlayerController and will not be able to get the data from the other clients unless you go through the GameState.
PlayerState on the other hand is not only replicated on the server but it is also kept up to date on all clients so it you will have no problem keeping the score when you re-spawn and you'll have access on all clients. It is also kept until the player disconnects do you can transfer the score in other GameModes (like main menu for example).
I suggest you read eXi's Multiplayer Network Compendium for additional information on the infrastructure.
Follow this question
Once you sign in you will be able to subscribe for any updates here