Is the player state stored on server?

Like the title says, is the player state stored on the server? I ask this because i want to know is it good/bad to use player state for game play logic (eg. health) or can it be hacked/compromised.

So if i do this within a server function :

Player->PlayerState->health += 10.f;

is that bad?

Every player (human or AI) will have a player state, it will live everywhere on the server and the client, it’s values are replicated through variable replication. So to answer you question you have to decide where the authority of your logic is, the server can perform the logic changing the values and those are then replicated to the clients (this would be an example in the case of health logic). So yes do it on the server :D. Also if the server is hacked you can’t actually do much about it.

One more question, If i create a variable in player state like say float health do i have to manually add it to replicate or does it replicate on its own since its stored in player state, and as for server being hacked i meant if the client is hacked and access client variables. Thanks for answering.

You have to add it manually to get replicated. This guide might help you out. Don’t forget to accept the answer :smiley:

Great thanks (i did accept but it unaccepted?)