Synzza Star - Automatic Battle Pause
I discussed in a previous post how I planned to work with Unity at a TimeScale of 0. Let's discuss how my implementation went.
When To Pause?
A key question when implementing this feature is: when should the game pause to let the player input? In my system, this is handled through events, and the events are dependent on a battler's "status state".
Status States
Battlers in Synzza Star have a component that tracks a status state. The values and meaning for these states are:
- OK
- The battler is not involved with executing a skill in any way and is not under duress.
- SkillWindUp
- The battler is preparing to perform a skill.
- SkillEffect
- The battler is performing a skill.
- SkillWindDown
- The battler is winding down from using a skill.
- Staggered
- The battler is in a stunned state, either from being hit with a skill or because a skill they used was blocked by their target.
- Blocking
- Self-explanitory.
A battler operating under normal conditions will have a skill it intends to use and another target battler on which it intends to use that skill. When a battler enters into "Staggered" or "SkillWindDown", that battler clears its target and waits for a new target to be given to it. For an NPC, this would be from an internal AI. For a player-controlled battler, this new target should obviously be provided by the player.
Pausing and Receiving Input
When a battler controlled by the player leaves any state and enters "OK", and if that battler does not have a target, the game will then pause and enter into a selection state. Here, TimeScale is set to 0, and the player can select between their available targets.
I mentioned earlier that events made this timing possible. Notice I mentioned that the pause happens when the battler enters into "OK" - this is because I want the player to select the skill when their battler has the capacity to perform it. This creates a natural flow to combat when the pauses happen after staggering or skill wind down.
There's more system design that contributed to this new feature - tune into future updates to read more about that if you're interested.
Comments
Post a Comment