Multiplayer Score

Hi,

I’m currently making a multiplayer games, but I’m wondering where I can or where I must store the player score, during play time, can I do it in the GameMode class or should I create a specific class to store the score ?

I have also the same question about the team composition, my player was automaticaly seperate between the 2 team
where can I do that ? in the gamemode before begin play, and where can I store the team composition ?

thanks a lot in advance

Depending on the data, you could store them in the game state, player state and game mode classes. It’s explained well in an earlier question:

https://answers.unrealengine.com/questions/43894/a-manager-class-in-gamemode-or-gamestate.html

If you want persistent data that you want to store across multiple levels, you can store them in game instance class. Anything store in this class will be persistent throughout the current running instance of the game. I’m not sure if it can be used for replication, but at level start you can get data from it and store in any of the above mentioned classes as they replicate automatically.

I’m not sure if the index orders in the server and client will be the same. I haven’t worked on replication, but maybe this is what you’re looking for:

I just need to store the player score, the team composition, and team score

so I will store :

the player score in PlayerState,
the team composition in GameState, in an array pof struct (player controler index, team number)
for the team score I can et the score from each player for the whole team, using the PC index right ?

So in my gamemode in the Postlogin event I create an Unique ID and I assign it to my PC in a replicated var, and I use this var to identify the PC