Day 15
Done today
- Created a global GameState object, holding (for now) a Mission.
- Created objective types and details, to be used for missions.
- Added a compact list of mission objectives in the game HUD.
- Added a more complete mission objectives list in the pause screen.
Global game state
I want to be able to look at and affect the current game state from any scene. As such, I made the GameState as an autoloaded script, using the CurrentGameState singleton name. The nice thing with this is that the same class can also be used to save and load the data to disk.
Mission and objectives
I created a Mission class, which can contain one or more objectives, as well as a summary, and an eventual “briefing script”. That script will be used to present the mission with a fixed dialog, actors, etc. For now, though, it’s only a string.
Each objective in the mission has a type, that defines what needs to happen: Destroy a number of enemies (any type or a special one), survive for some time, protect one or many units, capture spots or pick items up. By setting the type, the target quantity and some additional data (for some objective types), I can automatically format the objective as a short string (for the HUD) or a long one (for the pause popup), and display a formatted progression. I think this system will be flexible enough to manage what I want to do with it.
What’s next?
Tomorrow, I plan to work on the following:
- Have events in the game affect the current mission objectives (e.g. number of kills, time survived).
- Maybe a “Mission Complete” popup, when all objectives are met.