Alternate player and opponent control through explicit phases so only one side can act and each turn has one visible completion boundary.

Build the graph

  1. Add Begin Round, Player Turn, Resolve Player, Opponent Turn, Resolve Opponent, and End Round States.
  2. Use Actions on Begin Round to reset per-round counters and choose the starting side.
  3. Keep Player Turn active while player input is accepted. Transition on a submitted action or end-turn event.
  4. Resolve the submitted action in Resolve Player, then transition to Opponent Turn when its Actions finish.
  5. Let Opponent Turn run the AI decision. Transition after one committed decision, not every state-machine tick.
  6. Resolve the opponent action, then either begin the next round or enter End Round when the victory Condition is valid.

How it runs

The current phase owns input and decision-making. Resolution States apply animation, damage, movement, and other consequences without allowing the next side to act early. The loop ends only through the victory route.

For a manually ticked design, the game owner decides when to tick the State Machine and may limit how many States activate per tick. Keep that scheduling outside individual Actions so the turn boundary remains testable.

Key choices

  • Use an event or explicit ActionSubmitted value to leave Player Turn.
  • Store the chosen move before leaving the decision State.
  • Do not keep both player and opponent input enabled and rely only on UI visibility.
  • Put victory checks before the ordinary next-turn transition.

Verify in Play Mode

Submit one player action and confirm that input disables, its result completes, the opponent chooses exactly once, and control returns to the player. Force a victory during each resolution phase and confirm that End Round wins over the next-turn route.

Troubleshooting

Symptom Check Fix
Both sides act. Input ownership and phase activation. Enable only the current phase’s controller or input Actions.
The opponent acts repeatedly. Manual ticking and completion event. Stop after one committed decision and wait for resolution.
A completed match starts another turn. Transition priority. Put the victory route before the normal loop transition.