How do I initialize and keep track of game states?

I’m doing a simple puzzle game (no multiplayer) and I’m trying to understand how to initialize the game itself. I read about gamemode&state but most of the people refer to it talking about multiplayer games, so I’m bit confused.
When the game/level starts I need to instantiate some pawns (i use AIController to manage them), keep track of fired bullets, player’s score and so on. I will use this information to increase/decrease game difficulty at runtime or end the game.
Can you give me some hints or a basic example? Thank you

You can use the same principles as you’d for a multi-player game, here is a great description for networking if you’d really like to understand GameMode, GameState, PlayerState, etc: http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

For single-player, it doesn’t really matter, you can organize your code any way it’s comfortable for you. The nicest is of course if you keep the same principles as you’d do for multi-player, but in practice, you can get away by storing everything in the PlayerController, and never using GameState or GameMode. I don’t suggest it for bigger projects, but for fast prototyping or gamejam-size projects it really doesn’t matter.

Thank you for your answer and the incredible resource. I read the first part quickly. If I understood correctly because my game is not a complex and it is single-player i can use only the gamemode or gamemode + gamestate. In the first case my actors need to access gamemode to update its variables. Otherwise if i use gamemode + gamestate i can force actors to access only gamestate and leave to it the task of communicate with the gamemode.

For single-player, it’s totally your decision if you want to use those classes at all, how are you communicating between them, etc. It’s your choice if you want to stick to the original networking concept of those classes, or if you totally ignore them. Whatever fits your project the better :slight_smile: