Where should stats go?

So, I have four different structures where I could store this information:

  • The pawn
  • The AI Controller( I control my character through pathfinding, unfortunately )
  • The player Controller
  • Player state

Where am I meant to store the stats in a MOBA game? The character levels up, has different stats, they can be affected by equipment and other things, and they can have maximums/currents. From what I understand:

  • The pawn stores stats that are specific to this instance, such as current health.
  • AI Controller should store nothing in this case.
  • The player Controller should store non-current stats that are persistent throughout the game( rather than the pawn’s lifetime. ) Because this is shared between the local player and the server, we can store things that need to be replicated for UI purposes here.
  • I have no idea what player state is meant for. It’s stored only on the server, so why is it useful at all? Stuff like kills and deaths would need to be replicated to all clients anyway for UI purposes, so why put them here?

Following something like this, I end up with stats being all over the place. I can imagine this would be a huge mess. Can someone explain to me how all this works?

PlayerController only exist in Server and Owning Client, so PlayerState is used for replicate any thing PlayerController need to pass to all client (it like GameMode only exist on server, but to pass any information they use GameState), for example like Kill, or Dead stats you can store in PlayerState and replicate all client, on client you can check stat of all PlayerState and display on the scoreboard.

Any stats that is persistent as long as PlayerController is exist like Player Level, Kills, Assist, Score, Dead, you can store it in PlayerState.

The good thing is when you disconnect PlayerState will be put on Inactive PlayerState list, the moment you reconnect, it will check your UniqueNetId and pass the PlayerState back to you, so you can disconnect and resume play like in League Of Legend, will all stats intact.

For thing like character stat it can all decide by player level, weapon owned so no need to replicate that.