unreal-behavior-trees
БесплатноБез исполняемых скриптовНе проверенUnreal Engine 5 (UE 5.8) NPC AI with Behavior Trees, Blackboards, EQS and StateTree: decorators with Observer Aborts, C++ BTTask nodes and running trees from…
от gamedev-skills★ 12 656 звёзд на GitHubОб этом скилле
Unreal Behavior Trees, EQS and StateTree
Author NPC decision-making in UE5: a Behavior Tree reads a Blackboard, decorators gate branches, services keep keys fresh, EQS picks locations or targets, and an AIController runs it all. StateTree is the alternative for mode-based AI. Targets UE 5.8.
When to use
- Creating or fixing
BT_/BB_assets, decorators, services, customBTTask/BTService/BTDecoratorC++ nodes, or the AIController that runs the tree. - Writing or debugging EQS queries (
EQS_assets, Run EQS Query, the EQS Testing Pawn). - Building AI with StateTree (
ST_assets,UStateTreeAIComponent) or mixing it with a BT.
When not to use: writing your own behavior-tree or utility-AI runtime, outside Unreal's
assets → ai-behavior-trees-utility-ai. Choosing an AI architecture or engine-neutral
steering and pathfinding → game-ai. The pawn and controller classes themselves →
unreal-cpp-gameplay.
Behavior Tree or StateTree?
Both ship in UE 5.8 and Behavior Trees are not deprecated. Default: keep whatever the
project already uses. For a new AI, pick StateTree when the behavior is a set of modes with
explicit transitions (patrol, alert, combat), and a Behavior Tree when it is a priority list
that must re-evaluate when Blackboard values change. They also combine: the BT task
Run State Tree (UBTTask_RunStateTree) runs a StateTree inside a branch, and StateTree has
its own Run Env Query task for EQS. StateTree on an AI needs the StateTree and
GameplayStateTree plugins and a UStateTreeAIComponent on the AIController, with an asset
that uses the StateTree AI Component schema. Ask before adding a second system beside the
first.
Workflow
- Read the project first. Check
EngineAssociationin the.uproject(this skill targets 5.8). List existing AI assets and classes so you extend them instead of duplicating:find Content -name "BT_*" -o -name "BB_*" -o -name "EQS_*" -o -name "ST_*"andgrep -rn "AAIController\|RunBehaviorTree\|UStateTreeAIComponent" Source. C++ AI code needs"AIModule"in the module's*.Build.cs. - Blackboard (
BB_) first. One typed key per fact the AI remembers (TargetActor,LastKnownLocation,bIsInvestigating). The tree references this asset. - Run it from the controller. The pawn's AIController calls
RunBehaviorTree(BT)inOnPossess; that also initializes the Blackboard. Set the pawn's Auto Possess AI to "Placed in World or Spawned" and its AI Controller Class. - Shape the tree. Root Selector for priorities (combat, else investigate, else patrol); Sequences for steps that must all succeed. Put a Blackboard decorator on each priority branch and set Observer Aborts so a key change interrupts the running branch.
- Keep keys fresh with services on the branch that needs them (perception, distance checks). A service ticks only while its branch is active.
- Use EQS for "where" and "which" questions (cover point, nearest pickup): add a Run EQS Query task, set its Query Template and the Blackboard key that receives the best item, and pass parameters through Query Config.
- Write custom nodes in C++ only when the built-ins can't do it; read the reference below.
- Check it (see Verify).
Patterns
AIController that runs the tree (C++)
void AEnemyAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
if (BehaviorTree) // UPROPERTY(EditAnywhere) TObjectPtr<UBehaviorTree>
{
RunBehaviorTree(BehaviorTree); // also initializes the Blackboard the BT references
}
}
void AEnemyAIController::SetTarget(AActor* Target)
{
if (UBlackboardComponent* BB = GetBlackboardComponent())
{
BB->SetValueAsObject(TEXT("TargetActor"), Target); // must match the BB key name
}
}
// BB->ClearValue(TEXT("TargetActor")) drops the tree back to a lower-priority branch.
A reactive priority tree
ROOT
└── Selector
├── Sequence [Blackboard: TargetActor Is Set, Observer Aborts: Both]
│ ├── MoveTo (TargetActor)
│ └── Attack
├── Sequence [Blackboard: LastKnownLocation Is Set, Observer Aborts: Lower Priority]
│ ├── MoveTo (LastKnownLocation)
│ └── Wait 3s, then clear the key
└── Sequence (patrol)
├── Run EQS Query (EQS_NextPatrolPoint -> PatrolLocation)
└── MoveTo (PatrolLocation)
Both on the combat branch means: start combat the moment TargetActor is set, and leave it
the moment it is cleared.
Verify
Say which of these you actually ran; reading the assets is not a test.
- Compile the module (Windows:
Engine/Build/BatchFiles/Build.bat <Project>Editor Win64 Development -Project="<path>.uproject" -WaitMutex; Linux and macOS useEngine/Build/BatchFiles/Linux/Build.shorMac/Build.shwith the matching platform) and fix every error and warning in your files. - **Validate ass
Установить unreal-behavior-trees в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл unreal-behavior-trees?
Unreal Engine 5 (UE 5.8) NPC AI with Behavior Trees, Blackboards, EQS and StateTree: decorators with Observer Aborts, C++ BTTask nodes and running trees from an AIController. Use for UE enemy AI, BT_, BB_ or EQS_ assets, "my AI just stands there" or "MoveTo fails". Not for engine-neutral BT or utility code (`ai-behavior-trees-utility-ai`) or choosing FSM vs BT (`game-ai`).
Как установить скилл unreal-behavior-trees?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл unreal-behavior-trees запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic