Quick start: two-Cube distance AI
Validate the complete chain from typed conditions and scores to a behavior flow graph.
Open and run the example
Create and open the scene
Run PoBDS/Demo/Cube Duel/Create Assets, then Open Scene. Enter Play mode and focus the Game view.
Move the target
Use WASD to control the target Cube. The AI should switch between attacking, walking closer and running closer.
Inspect the graph
Use Open Flow to inspect CubeBrain; double-click its BDS node to open CubeDecision. During Play mode, select the corresponding running AI instance.
Define unambiguous distance ranges
| Distance in millimeters | Behavior | Demo parameter |
|---|---|---|
| Distance ≤ 2000 | Attack | 10 damage every 600ms |
| 2000 < distance ≤ 5000 | Walk closer | 1500 mm/s |
| Distance > 5000 | Run closer | 4000 mm/s |
Each boundary belongs to exactly one branch. Use integer millimeters consistently: 2000 and 5000, rather than mixing meter values with millimeter properties.
Configure the same AI manually
Create the root flow
Connect Entry to a BDS node and reference CubeDecision. New nodes are initially disconnected; wire them manually.
Add three Abilities
Create Attack, Walk and Run candidates. Use comparisons and AND gates for the ranges above. Equal base scores are sufficient because their gates are mutually exclusive.
Supply distance
Read an integer millimeter distance property or the built-in target-distance value. Connect it to the comparison; enter thresholds inline or use constant nodes.
Assign execution graphs
Select Attack, Walk and Run flow graphs in the corresponding Executions. Inside each graph connect Entry to an Action and configure the demo behavior.
Save and verify
Save the child graphs and BDS. Place the target at approximately 1m, 3m and 7m and inspect the actual executing branch.
Read the editor layout
Why walking can transition into attacking
Cube Duel movement Actions finish when their distance interval changes, allowing BDS to select another candidate. A continuous custom Action that never finishes will keep updating unless an eligible forced-interrupt candidate replaces it.