Phases of a turn
One of the first times I really thought about game states in a game was when I was learning Magic: the Gathering. There, it can be really important to know which phase of the turn is currently occurring, so much so that sometimes, you need to explicitly say things like "I'm beginning my upkeep phase" or "I'm about to end my main phase", so that opponents were given the opportunity to react during that phase.
When I started working on Button Men, I thought that things would be much simpler, and that turn order wouldn't be nearly as important. Looking at the status of class BMGameState in July 2013, many of the game states were already present:
The current list of game states is:
One game state that I find interesting is COMMIT_ATTACK. This didn't appear until June 2014, as part of the implementation of Fire dice. Previously, much of the attack-related logic occurred in START_TURN, but the change in value of fire dice would have happened right in the middle of this logic. As a result, the logic occurring in START_TURN was split between START_TURN and COMMIT_ATTACK, and a new game state ADJUST_FIRE_DICE was added in between these two.
One game state that was rather tricky to work out was CHOOSE_TURBO_SWING_FOR_TRIP. Trip attacks are odd because there's all sorts of things that trigger on a reroll, and in this case, they occur for the opponent's die too, before any potential capture can take place. Thus, much of the logic to deal with trip attacks (including logging what actually happened) is actually almost a duplicate of the logic that occurs during a normal attack, but it just happens earlier. Timing issues are critical when various die skills interact, and it just wasn't possible to get all the logic right without introducing a new game state.
Now that almost all of the major skills have been implemented, it's likely that the game states will remain almost unchanged. It's our aim that the turn order will remain just as invisible as it has been to date.
Hopefully, we'll never have the situation in Button Men where we'll need to explicitly declare which game state is occurring. However, if such a situation arises because of a dastardly new die skill, we're ready for it.
When I started working on Button Men, I thought that things would be much simpler, and that turn order wouldn't be nearly as important. Looking at the status of class BMGameState in July 2013, many of the game states were already present:
- startGame
- applyHandicaps
- chooseAuxiliaryDice
- loadDiceIntoButtons
- addAvailableDiceToGame
- specifyDice
- determineInitiative
- startRound
- startTurn
- endTurn
- endRound
- endGame
The current list of game states is:
- START_GAME
- APPLY_HANDICAPS
- CHOOSE_JOIN_GAME
- SPECIFY_RECIPES
- CHOOSE_AUXILIARY_DICE
- CHOOSE_RESERVE_DICE
- LOAD_DICE_INTO_BUTTONS
- ADD_AVAILABLE_DICE_TO_GAME
- SPECIFY_DICE
- DETERMINE_INITIATIVE
- REACT_TO_INITIATIVE
- START_ROUND
- START_TURN
- CHOOSE_TURBO_SWING_FOR_TRIP
- ADJUST_FIRE_DICE
- COMMIT_ATTACK
- CHOOSE_TURBO_SWING
- END_TURN
- END_ROUND
- END_GAME
- CANCELLED
One game state that I find interesting is COMMIT_ATTACK. This didn't appear until June 2014, as part of the implementation of Fire dice. Previously, much of the attack-related logic occurred in START_TURN, but the change in value of fire dice would have happened right in the middle of this logic. As a result, the logic occurring in START_TURN was split between START_TURN and COMMIT_ATTACK, and a new game state ADJUST_FIRE_DICE was added in between these two.
One game state that was rather tricky to work out was CHOOSE_TURBO_SWING_FOR_TRIP. Trip attacks are odd because there's all sorts of things that trigger on a reroll, and in this case, they occur for the opponent's die too, before any potential capture can take place. Thus, much of the logic to deal with trip attacks (including logging what actually happened) is actually almost a duplicate of the logic that occurs during a normal attack, but it just happens earlier. Timing issues are critical when various die skills interact, and it just wasn't possible to get all the logic right without introducing a new game state.
Now that almost all of the major skills have been implemented, it's likely that the game states will remain almost unchanged. It's our aim that the turn order will remain just as invisible as it has been to date.
Hopefully, we'll never have the situation in Button Men where we'll need to explicitly declare which game state is occurring. However, if such a situation arises because of a dastardly new die skill, we're ready for it.
Comments
Post a Comment