Game Instance for each player?

Hi everyone !
I want to make a multiplayer game, something like the system of Clash Royal.

So i want when you open the game, you set your variable like Level, Gold, etc… from a server thanks this tutorial VaResLogin so i update this variables inside myGameInstance.

Then when you start a party against an other player how can you store the variables of each player’s game instance inside each player’s pawn ? I don’t want player have the same game instance because they will have the same level, gold, etc…

Thank you for your help! I’m still looking on internet :slight_smile:

I Think PlayerState is what you’re looking for.

The PlayerState it’s spawned for each player on joining a session and can be accessed from other players.

You could create your variable inside it,and then on begin play or construct you can get your data from the server and set it to the variables in the playerstate.

Or maybe i can update this variables for each player pawn when you start the party inside the gamemode blueprint ?

GameInstance exists each time the engine starts, and isn’t destroyed when loading a new map. It’s mainly for persistent data and errors.

Player state can be updated with your rest system easily

Ok thank you for all your answers, i will look for player stats blueprint ! :slight_smile: