I am currently writing a simple board game app.

I have written some basic states which are more to do with global state of the game.

Currently they are just enums, they don't really do anything nor is there a manager.

Something like this;

enum {
GameStateInitialize = 0,
GameStatePlaying = 1,
GameStatePaused = 2,
GameStateEndGameConditionMet = 4

Most board games I've played have a linear list of "phases", my own digital board game tries to replicate this. During the GameStatePlaying the board game has various phases, sequentially driven; again these are just enums for now.

enum {

During PhaseTaxes it will check for whether a game end condition has occurred; if it has it needs to trigger the GameStateGameEndConditionMet

Here's the problem I'm having.

Could game-phases, and game-states be combined? I'm really not sure how to make sure that it doesn't do a certain phase if the game end condition has been met?

Should gamePhase and gameState the same?



No, gameState and gamePhase should not be the same.

Your design is correct. You can have a state machine within a state of another state machine. Keeping the concepts separated like you did is the way to go.

The only issue you might encounter is that the wording you use might get confusing.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .