PlayerController/PlayerState different on client and server.
I am trying to create a multiplayer game and I have run into this problem. I set some data in the player controllers and have them possess pawns OnPostLogin in my Custom GameMode. I can see this data for both players (server and client) while viewing the server window. However on the client window this data is no longer there. Upon further investigation I have noticed that the server has instances of playerController_1 and playerController_2 but the Client has playerController_3. If i understand correctly the PlayerController exists on the server and the owning client which is what I want, but I want the client to have the same PlayerController that I initialized the data for in my game mode OnPostLogin.
I also looped through the PlayerStates that the client sees opposed to the server. The server has playerState_1 and playerState_2 while the client has playerState_3 and playerState_4. I was under the impression the same player state with the same data would be replicated to all clients.
I have read as much as I can find on replication and the framework for unreal but I am still a novice, any insight regarding what is happening here would be helpful.
Thanks in advance.
I have solved some of the problems. Regarding the player state issue, I was not replicating the values correctly I had forgotten this.
After fixing that with the player state I tested replicating simple variables on my player controller. The data did get passed to the clients when I did it this way. So I think I have pinpointed my problem, replicating pointers to Actors that are located in my PlayerController.
When I check the value of playerHand or spellDeck for the client the value is null.
PlayerControllers do not replicate, hence player controller on the serverside and client side are dfferent ones.
"If i understand correctly the PlayerController exists on the server and the owning client which is what I want," This isn't correct , PlayerController exist locally on each machine with it's own id. if you get player controller with id of 0. You will always return the local player ( unless it's a splitscreen ).
answered Nov 05 '15 at 08:17 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here