Player State VS Player Character
If i have a bunch of data that varies from character to character (Health, mana, energy, levels, etc). Would it make sense to put all this in Player State or Player Character?
asked May 20 '15 at 10:14 PM in Blueprint Scripting
PlayerState is used to replace PlayerController in network replication for all clients so it is exist through out the level with PlayerController and it use use to store the variable that matter even if your character is not there or dying like score, level, kills, deaths, character type/class,...
Anything that define of your character you can put in like health, mana, energy....
For example in MOBA game, your should put level in Playerstate, coz when your character die, all the stat in character will be reset, so you still can grab the level from Playerstate and re-init your character base on level, same go with items, weapons. In case of disconnected and reconnected, PlayerState will be saved, and your can get back all of that when player reconnect to server.
answered May 21 '15 at 02:55 AM
PlayerState is extension of PlayerController, main diffrence is that PlayerState is replicated, PlayerController is not. PlayerController is not replicated for security reasons, if PlayerControllers information would be contained in client memory there risk it could be manipulated, it a open window for cheat software, best example is GTA:SA multiplayer mod which fully synchronizes clients without any safety measures (since GTA:SA is not really made for multiplayer), typical single player hacks are normally replicated to other clients there. Thats why PlayerControllers are only on server side and they control pawns on server which later are replicated to clients. PlayerState is where you place information from PlayerController that you want to be replicated to all clients, but server should not relay on that information, so you just copy information that clients need to know.
Same thing with GameMode and GameState
answered May 21 '15 at 03:14 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here