Download

Replicating playerstate issue

In a nutshell, I have a lobby system where two players are given a side. Since I use seamless travel, I store the two player controllers in Game Instance blueprint since GameState and PlayerStates get nuked. So, on server side, I store the two PlayerControllers in GameInstance and on client side, two PlayerState objects inside GameState.

In GameState blueprint, once the Game map loads, I run a check if we have authority and then fetch the two Player Controllers from Game Instance, get the PlayerState objects inside them and store them in my variables, hoping to get them to replicate. I made them rep-notify to give me some feedback on when they’re updated and saw that only one of them will be, the server playerstate.

Am I doing something fundamentally wrong here? I’ve wrestled with it for better part of the day and can’t figure it out.

Okai, I’ve narrowed the issue down.

Apparently on the server side, PlayerStateA - the client one, doesn’t get destroyed during seamless travel so when the Game map has loaded, the server replication determines the client has the latest PlayerStateA reference and doesn’t update it. The issue was that the PlayerStateA actually got destroyed on the client and if server doesn’t update it with the new one, it just keeps the old non-existing object reference.

It’s weird because I was under the impression all the PlayerStates and GameState gets re-made and reset to zero once a new map has loaded. Is there any reason why my listen server nukes his own PlayerState and keeps the client one?

I read hundred threads I think. Even if you had this issue in 2015 and you have an other goal, I have the same issue. My Client lost its player state and the player state only lives on server and client will not get new one after ServerTravel with Seamless Travel. I have tested a lot, trying in GameModes of Lobby and GameMap different PlayerStates, same playerstats, different controller, same controller, etc…
But the “issue” comes randomly again. It comes very seldom when testing locally with stand alone versions, but it came often after publish the version to steam and play with real steam environment.
I posted my question here, but it’s not made visible by a moderator. Will need some hours.
https://answers.unrealengine.com/que…vertravel.html

Did you ever found out why sometimes playerstates of server and clients get out of sync? Or on one side it gets deleted and on the other not? In my case it’s more, on one side it is generated (server) and on client side not (invalid on check playerstate).

Thanks a lot. Hope you are still active. :slight_smile: