This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| dragengine:modules:dragonscript:statemachines [2026/10/09 20:01] – [Examples] dragonlord | dragengine:modules:dragonscript:statemachines [2026/10/09 20:02] (current) – [State Machines] dragonlord | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| __States__ and __transitions__ can contain __actions__ which modify game state. Actions are typically provided by [[behavior_elements|behaviors]] to control the behavior or behaviors linked to them. Actions are supposed to not fail and throw exceptions only if something is really wrong. Instead they should provide conditions to check if actions could be properly applied or not. If the state machine can not find an action it is treated as if it matches an empty action. It is thus allowed to define actions that do not exist. This can be used to run actions on behaviors which might not be present in an element class. To find problems with missing actions use the debug feature in [[behavior_statemachine|ECBehaviorStateMachine]]. | __States__ and __transitions__ can contain __actions__ which modify game state. Actions are typically provided by [[behavior_elements|behaviors]] to control the behavior or behaviors linked to them. Actions are supposed to not fail and throw exceptions only if something is really wrong. Instead they should provide conditions to check if actions could be properly applied or not. If the state machine can not find an action it is treated as if it matches an empty action. It is thus allowed to define actions that do not exist. This can be used to run actions on behaviors which might not be present in an element class. To find problems with missing actions use the debug feature in [[behavior_statemachine|ECBehaviorStateMachine]]. | ||
| - | __Conditions__ can be paramtrized | + | __Conditions__ can be parametrized |
| + | |||
| + | __Condition Groups__ allow to create complex, nested conditions. This can be used to represent mixed '' | ||
| States can have __enter actions__ and __exit actions__. __Enter actions__ run after activating the state. Exit actions run before switching to another state. Enter and exit actions both can have conditions which determine if the action is run or not. Enter actions can have a __state change__ assigned. If an enter action with a state change is run the state changes immediately to the specified state and all enter actions afterwards are ignored. This can be used to automatically transition into another state for example if a pre-condition is not fulfilled or an earlier action failed to run properly. In particular no action can be assigned in which case the enter action only serves the purpose to transition into another state if its conditions fail. In addition states can be assigned an __auto-transition state__. If all enter actions are processed and the state has an auto-transition state assigned the auto-transition state is immediately activated. This allows to create pass-through states which only run a couple of enter actions then transition into the final state. | States can have __enter actions__ and __exit actions__. __Enter actions__ run after activating the state. Exit actions run before switching to another state. Enter and exit actions both can have conditions which determine if the action is run or not. Enter actions can have a __state change__ assigned. If an enter action with a state change is run the state changes immediately to the specified state and all enter actions afterwards are ignored. This can be used to automatically transition into another state for example if a pre-condition is not fulfilled or an earlier action failed to run properly. In particular no action can be assigned in which case the enter action only serves the purpose to transition into another state if its conditions fail. In addition states can be assigned an __auto-transition state__. If all enter actions are processed and the state has an auto-transition state assigned the auto-transition state is immediately activated. This allows to create pass-through states which only run a couple of enter actions then transition into the final state. | ||