PRIMARY BOSS STATE TREE
One clear loop, many possible moves.
Every move returns to Root: clear the previous state, read the current context, choose a response, execute it, and evaluate again.
- 01
CleanupReset movement, rotation, and gravity so each decision begins from a reliable state.
- 02
EvaluatorRead the predicted next move from the n gram model. I tested n=2 and n=3, then chose n=3 because using the player’s previous two actions made the response feel more intentional while still leaving room to learn and react.
- 03
Distance and resource testsGate the move pool by range, player health, stamina, and sword charges. Sword charges are the player’s primary way to heal, or they can be spent for additional damage, so reacting to them changes the risk of the next exchange.
- 04
Ability SelectorChoose one scoped move, execute it, then return to Root. Short and long range pools keep the available responses relevant to the current spacing.
WHY THE STRUCTURE SCALESAdd the rule, add the move, reuse the loop.
To introduce a new attack, we add its distance or context rule, place the ability in the selector, and let the shared flow handle cleanup, evaluation, execution, and the return to Root. That made the encounter highly modular and easy to extend without rebuilding the decision logic around every move.