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
asked Mar 26 '19 at 03:34 PM in C++ Programming
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here