You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/manual/selector.md
+44Lines changed: 44 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,50 @@ Type of Node | Child returns `RUNNING`
14
14
`SelectorComposite` | Tick again
15
15
`SelectorReactiveComposite` | Restart
16
16
17
+
`Tick again` means that it will (for each consecutive tick) skip previous nodes that already ran and tick **only** the current `RUNNING` node again until it is no longer `RUNNING`.
18
+
19
+
`Restart` means that it will tick all previous nodes that already ran and then tick the current `RUNNING` node again.
20
+
21
+
### When to Use Restart vs Tick Again
22
+
23
+
The choice between "restart" and "tick again" behaviors impacts how your selector responds to dynamic game environments:
24
+
25
+
#### When to Use "Tick Again" Behavior
26
+
Choose a selector with "tick again" behavior (`SelectorComposite`) when you need to:
27
+
28
+
-**Maintain action continuity**: Ensure long-running tasks complete without interruption
29
+
-**Preserve computational resources**: Avoid re-checking conditions that are unlikely to change
30
+
-**Create stable, predictable behavior**: When commitment to the current action is more important than responsiveness
31
+
32
+
**Example**: A character performing a special ability that must complete its full animation sequence before considering other options.
ββ IsEnemyNearby (Condition: not evaluated while ability is running)
39
+
ββ Patrol (Action: not evaluated while ability is running)
40
+
```
41
+
42
+
#### When to Use "Restart" Behavior
43
+
Choose a selector with "restart" behavior (`SelectorReactiveComposite`) when you need to:
44
+
45
+
-**Prioritize responsiveness**: Immediately react to changing high-priority conditions
46
+
-**Implement interrupt-driven behavior**: Allow higher-priority tasks to interrupt lower-priority ones
47
+
-**Handle volatile environments**: Re-evaluate all options when the game state changes frequently
48
+
49
+
**Example**: An AI that should immediately respond to threats regardless of current activities.
50
+
51
+
```
52
+
SelectorReactiveComposite
53
+
ββ IsUnderAttack (Condition: initially failure, later success)
54
+
β ββ DefendSelf (Action: will interrupt ongoing tasks when under attack)
55
+
ββ IsHungry (Condition: success)
56
+
ββ SearchForFood (Action: interrupted when attack detected)
57
+
```
58
+
59
+
The "tick again" approach improves performance and ensures action completion, while "restart" provides greater adaptability to changing conditions at the cost of potentially interrupting ongoing tasks.
60
+
17
61
## Selector Random
18
62
The `SelectorRandomComposite` node behaves similarly to the Selector Star node, but instead of executing its children in the given order, it executes them in a random order.
Copy file name to clipboardExpand all lines: docs/manual/sequence.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,48 @@ Type of Node | Child returns `FAILURE` | Child returns `RUNNING`
17
17
`SequenceReactiveComposite` | Restart | Restart
18
18
`SequenceStarComposite` | Tick again | Tick again
19
19
20
+
`Restart` means that it will tick all previous nodes that already ran and then tick the current `RUNNING` node again.
21
+
22
+
`Tick again` means that it will (for each consecutive tick) skip previous nodes that already ran and tick **only** the current `RUNNING` node again until it is no longer `RUNNING`.
23
+
24
+
### When to Use Restart vs Tick Again
25
+
26
+
The choice between "restart" and "tick again" behaviors has significant impacts on your sequence's effectiveness in different scenarios:
27
+
28
+
#### When to Use "Restart" Behavior
29
+
Choose a sequence with "restart" behavior when you need to:
30
+
31
+
-**Validate preconditions continuously**: Ensure all previous steps still hold true while executing a sequence
32
+
-**Handle dynamic environments**: Re-check environmental conditions that might change during execution
33
+
-**Maintain safety checks**: For critical operations where all conditions must remain valid throughout
34
+
35
+
**Example**: A character needs to pick up and use an item that might be taken by another character. Using `SequenceReactiveComposite` would re-check if the item is still available before attempting to use it.
36
+
37
+
```
38
+
SequenceReactiveComposite
39
+
ββ IsItemAvailable (Condition)
40
+
ββ MoveToItem (Action: running)
41
+
ββ UseItem (Action)
42
+
```
43
+
44
+
#### When to Use "Tick Again" Behavior
45
+
Choose a sequence with "tick again" behavior when you need to:
46
+
47
+
-**Optimize performance**: Avoid redundant checks of conditions that won't change
48
+
-**Complete multi-step procedures**: Ensure a procedure completes without unnecessary rechecking
49
+
-**Create predictable, deterministic behavior**: When you want guaranteed completion of a series of steps
50
+
51
+
**Example**: A character performing a complex animation sequence that should complete regardless of minor environmental changes would benefit from `SequenceStarComposite`.
52
+
53
+
```
54
+
SequenceStarComposite
55
+
ββ StartAnimation (Action: success)
56
+
ββ PlayMainAnimation (Action: running)
57
+
ββ EndAnimation (Action)
58
+
```
59
+
60
+
The performance benefits of "tick again" come at the cost of responsiveness to changing conditions, while "restart" provides better adaptability but with higher computational overhead.
61
+
20
62
## Sequence Random
21
63
The Sequence Random node behaves similarly to the Sequence Star node, but instead of executing its children in the given order, it executes them in a random order.
0 commit comments