Please correct me if I am wrong.
As fas as I understand
A GameState holds infos about the state of the current game.
- PreGame
- Waiting for players
- Playing
- maybe the list of team + score
- etc…
A PlayerState represents the current state of one player
- Health
- Score
- Team it belongs to
- etc …
In a network game who has control over the GameState/PlayerState and to who and when is it replicated?
I need to setup new Player in the login/postlogin function of my gamemode but the changes only stay on the the listenserver or only on the client .
If I am a PlayerController I can access my PlayerState to set/get variables but if the server changes a variable of my PlayerState how do I notice the change? I tried it with OnRep_* on PS variables but then I can’t find a way back to the PlayerController. There are functions in the PS to get the PC (GetPlayerControllerFromNetId or GetNetOwningPlayer()->PlayerController) but for whatever reason those are always NULL on the Client.
I don’t want to put all the information directly into my Character or PC classes if there are other classes out there that are designed to hold replicated data.