Download

Where to count player statistics, to show them at the games end?

I’m looking trough the StrategyGameExample at the moment (Strategy Game | Unreal Engine Documentation), and in the


OnActorDamaged

method of the AStrategyGameState, it counts how many damage each team deals. However, there is a


// @Todo, this is def not the place for this

above that logic, so I’m wondering where the right place for this is.

In the StrategyGameExample, the data is not used anywhere as far as I can see, but let’s assume I want to show it at the end or during the game in a statistics screen or something.

I suppose the GameMode is the right place to count score and get it later.

You can use GameState replicated variables. I’m not sure if GameMode supports replication, because it’s only server-side from what I read somewhere.

Depending on what information you want to store there are two main places to store information.
GameState - Information about the current game (i.e. RoundTime)
PlayerState - Information about a player (i.e. Kills, Deaths, etc)

These are the classes to store information in regardless of whether the game is online or not. If the information needs to be replicated however, both of these classes exist on the client and on the server and can be replicated.