24 - Gameplay Framework, Instance, Save, Mode and other stuff
I wanted to go back to the game loop logic and introduce a PlayerScore, basically the nomber of snakes killed, and, PlayersCoins, coins system for upgrading weapons, buying pickups and so on. But soon I had a problem of understanding: which class should handle what? How do I update the HUD values? Which class modifies what?
I took couple of days to read some documentation, read articles, watch tutorials. Here is the list of sources I found useful in my quest to master the Unreal Gameplay Framework:
- Gameplay Framework from Unreal documentation (what a surprise)
- The Unreal Engine Game Framework: From int main() to BeginPlay by Alex Forsythe, an deep-dive on how the engine works
- Saving and Loading Your Game also from Unreal documentation
- Gameplay Framework blog posts by Cedric Neukirchen
After digesting all this information, and with the help of ChatGPT, here is what I have decided to do for my game:
- A
SaveGameclass to be able the pass player info from on game to another - A
GameInstanceclass managing the loading/saving system and being the source for global variables likePlayerName,PlayerScoreandPlayerCoins - The
GameModeclass managing play rules, win or defeat conditions based on player health, score and so on - The
PlayerControllerclass being responsible to update theHUDand interacting with theGameModeand theGameInstance
To fit this “framework” I had to rework some of my classes as the PlayerController and the GameMode. Here is a detailed example of how my classes interact with each other in the shooting snakes workflow:

An example of my new framework implementation.