Storing player stats over multiple levels

Hey all!

We are working on a multiplayer party game about cats :smiley_cat:. It will be both local and network/online.

I have a simple question about where to store player data over multiple levels (because our game comprises of a series of mini games). We would have thought that the “player state” would have been the ideal place to keep player score (It’s used as an example in the description of player state), but we noticed this data isn’t retained across levels like we need in our genre of game. Does that mean we should be storing player score stats in the “Game instance” instead to retain it across levels? Also we noticed the “Use seamless travel” checkbox and thought perhaps that would help us hold onto this data, but it’s not giving results as expected.

Can anyone give us a little guidance here or point as to a good place to learn more about these particular situations?

Many thanks!
-Dan

I don’t know anything about game states and game modes (great thing when you’re developing a game alone) but I think game mode can work. Why not jsut try it?

In the MP game I’m working on, I use GameModes to set up rules for the current game and all stats are stored in my game state for that game mode. Example: A game of Team Death Match uses my TDM game mode to set the rules and the TDMState to track all the information such as points, score, players, teams, win conditions, etc. iirc, the game mode is only accessed by the server but the clients can access information from the game state.

So you should be able to save all your information in the game state and use it between levels as long as the levels use the same mode and state.

Also you could try using Game Saves to store to retrieve certain when needed. In my game, I use game saves as well to store a players total number of kills, deaths, losses, etc. and that information can be pulled from the Game Save at any time.

You, for sure, should keep Stats and Points on the Serverside only!
So… no SaveGameObject or anything… since they can easily be manipulated!

Since GameMode won’t replicate Stuff, and is, like the Gamestate, not persistent… there is only this one option:

Store the Stats and Points in the authority GameInstance on Levelchange and load it back into GameState after Loading.

1 Like

Patrick’s solution is probably best. The game instance should be the best place to store and retrieve information on a per level basis. Other methods but this would be the most efficient solution

1 Like

Hey Patrick! Thanks so much, make sense!

:+1:

I also think the game instance is the place to store your stats across levels. You can pass these variables from the player state to your game instance as well.

As far as saving the info for when you close the game and reopen, save game is gonna be the easiest place to save that info. Its not fool proof though.

As far as I have been able to find the only way to keep people from tinkering with it is a server system that stores player information on a php/mysql database. I myself would love to chat with someone with info on that.

1 Like

yes, use game instance, also check here:
https://www.tomlooman.com/unreal-engine-gameplay-framework/

1 Like

Awesome, thanks for the confirmation and reference guys!!!