Game mode - game state relation

hello,

im having a bit of trouble understanding the correct relation between game mode and game state.

I know that game mode should set the rules and keep track on player, and is only exposed to the server, while game state replicates to clients and should hold information about the current state of the game.

So if i set up a simple deathmatch game, where a player needs to kill 30 enemies to win, what would be the distribution in the blueprints?

To my understanding , the method of “Player has died” should be in the game mode, which when called by the server -

  1. tells the game state to add a score to the killing player (in its player state) and check the winning condition (kills=30).

the value of 30 will be in the game mode.

  1. queue the killed player for respawn (respawn time is in game mode)

Is this correct?

Thank you.

In my understanding GameMode is more of a “connection manager” than anything else. Yes it holds some rules but they are mostly needed to initialize the game like how many players can connect at once, are they on teams, which pawns do they use. In the end it is also responsible for initializing the next GameMode when the goal of the game is reached.

GameState is more of a data storage and communication manager. Since it has access to all clients and they have access to it it is very easy to use it so store leader boards, timers, and it manages all PlayerStates.

Be sure to check eXi’s Multiplayer Network Compendium.

What should and should not go in a specific class is a bit murky especially for low priority things. Your approach is perfectly valid but you can realize it in many other ways which will present it’s own problems and benefits.

Here is an example: Score is can be kept in the PlayerController and PlayerState could compile a scoreboard table and re-spawn the players. It is not a perfect approach but it is valid too.