I have a quick question about PlayerStates, but first let me explain my situation. So I’m making a game where you create and manage your characters in the main menu and play as them on my server. These characters (not actual "ACharacter"s derived from AActor) will store values like Name, Level, SkeletalMesh (Male/Female), Team, etc.
Now my question is, what is the appropiate class to store these variables in? Would I make an array of a struct containing all this information in my PlayerState? For now I’ve been using PlayerController but I’ve recently found out some stuff about PlayerStates, could someone explain to me what variables should be stored in the PlayerState?
PlayerStates are used for online stuff that should store general information that other players on the server would need.
These things are some of the things stored out of the box in the player state:
Player Name
Ping
You might want things like score to be stored there as well.
Keep in mind that PlayerStates are alway relevant, which means they always send network updates. Ideally player states should not have a lot of information in them since it will use a lot of bandwidth.
For your situation it sounds like you could store the Name and level in the player state, but store the SkeletalMesh in the player controller, depending on if you need other players to see that information at all times.
You probably would want to store things related to your character/ pawn in the player controller. Though other players will not be able to see anything in the player controller since its only created for the server and owning client. So If no one else need to know those things, the player controller is the best bet.
Okay, so I should store values that all should be relevant at all times in my playerstate? But, let’s say I have an attributes system which allows the player to level up certain stats (like max health, stamina, carryweight, melee damage, etc.), what would be the ideal class to store such information in? Playercontroller? Because they don’t need to be relevant at all times, only when they’re leveled up.
Also, I just want to apologize for my late reply, been a little busy lately. Although thanks alot for helping!