Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"


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?

Product Version: UE 4.20
more ▼

asked Aug 29 '18 at 09:56 PM in Blueprint Scripting

avatar image

73 3 8 14

avatar image dZh0 Aug 29 '18 at 10:43 PM

Does this setup work - store the ZombiesKilled in Character BP and replicate?

Where do you create the core list itself?

avatar image Nico_Pucho_27 Aug 29 '18 at 10:45 PM

when the player shoots it sends the info to the server, the server deals the damage to the enemy and then if it died it increments the integer value zombiesKilled that then is replicated back to the player

avatar image Nico_Pucho_27 Aug 29 '18 at 11:10 PM

it is a single variable and it is stored in the character BP

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Aug 30 '18 at 09:01 AM

avatar image

1.3k 6 5 9

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question