x

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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Player State: None on multiplayer clients

I'm currently attempting to access the player states of other players from the local player. However it seems that client pawns don't have a player state in my setup. Context: Process Scores is called on Tick, Self is my pawn which is created and possessed by the server in my GameMode, the resulting log looks like this:

 LogBlueprintUserMessages: [VRBaseBP_C_0] Client 1: I don't have a player state
 LogBlueprintUserMessages: [VRBaseBP_C_1] Client 1: I don't have a player state
 LogBlueprintUserMessages: [VRBaseBP_C_0] Server: I have a player state
 LogBlueprintUserMessages: [VRBaseBP_C_1] Server: I have a player state

Blueprint generating the log:

alt text

Additional thoughts:

  • The documentation on PlayerState says the following: "PlayerStates are replicated to all clients"

  • I am able to access all PlayerStates through the GameState PlayersArray on both the clients and the server (however I need to know which pawn is attached to the PlayerState so this isn't particularly helpful)

Product Version: UE 4.12
Tags:
playerstatebp.png (69.8 kB)
more ▼

asked Jun 30 '16 at 08:36 AM in Blueprint Scripting

avatar image

Dr_Jerm
103 13 15 19

avatar image HungryDoodles Jun 30 '16 at 11:15 AM

This is really strange. Maybe Replicates parameter isn't true, but it's true by default anyways. I had a problem similar to this: when pawn just spawned it hadn't Player State on clients. It's appears after couple frames without any notification because of network lag. But I needed PS to initialize the gun, or player will be unable to shoot. Fixed it by moving Player-State-dependent code to server side.
PlayerStates themselves are replicated, their variables always valid among network members.
And yeah, only server should control pawn possession, if client will possess pawn next thing will happen:
Client will possess pawn, but server will think, that nothing happened, so replicated variable PlayerState will stay null;
Client will be able to control pawn, especially if pawn movement isn't replicated, but as soon as something changes with this pawn on server side there will be problems.

avatar image Dr_Jerm Jul 09 '16 at 02:08 AM

Bumping for visibility.

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

1 answer: sort voted first

Hi there

Here is an example for you to try: alt text

The example is not perfect but gives you the idea. On begin play it checks if the server is getting the player state, if so, check if valid and feed the variable. If not then the client Ask the Server to get their player state. So the server executes and feeds the client´s player state

Try something similar to my example and it will work. Good luck

example.png (222.2 kB)
more ▼

answered Mar 22 '17 at 02:58 PM

avatar image

FilipeTessaro
1.4k 54 19 60

(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