unreal-behavior-trees
Что он делает
Этот скилл объясняет, как настроить ИИ неигровых персонажей в Unreal Engine 5 с помощью деревьев поведения. Он нужен разработчикам, которые создают врагов или других игровых персонажей, принимающих решения.
Когда использовать
- ✓Когда вы создаете врага или NPC, который должен сам выбирать действия в Unreal Engine 5.
- ✓Когда нужно добавить условия или периодические проверки в структуру решений ИИ.
- ✓Когда вы хотите написать собственные узлы поведения или подключить контроллер ИИ к дереву поведения.
Ссылка на скилл
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/unreal/unreal-behavior-trees/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Сделай так, чтобы мой враг в Unreal патрулировал, пока не увидит игрока, а потом преследовал его.”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Скилл объясняет, как организовать дерево с помощью селекторов и последовательностей, добавить условия и фоновые обновления и запускать дерево из контроллера ИИ, который использует блэкборд для общей информации.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с GitHub.
Unreal Behavior Trees
Author NPC decision-making in UE5 with Behavior Trees driven by a Blackboard: structure the tree with composites, gate branches with decorators, keep state current with services, and run it from an AIController. Targets UE 5.8.
When to use
- Use when building enemy/NPC AI: creating a
BT_/BB_asset pair, structuring Selector/Sequence branches, adding decorators (conditions) and services (periodic updates), writing customBTTask/BTServicenodes, or wiring an AIController to run the tree. - Use when the project has Behavior Tree (
BT_) and Blackboard (BB_) assets and anAAIController.
When not to use: the concept of AI (FSM vs BT vs steering, cross-engine) →
game-ai. Pure navigation/pathing math is engine navmesh (BT's MoveTo uses it). Simple
one-off logic may be cheaper as a small state machine than a full tree.
Behavior Tree or StateTree? UE 5.8 ships both, and Behavior Trees are not deprecated.
StateTree is Epic's general-purpose hierarchical state machine: it combines BT-style
selection with explicit States and Transitions. If the project already uses StateTree
assets, or the AI is naturally a set of modes with clear transitions (patrol → alert →
combat), check with the user before adding a Behavior Tree next to it. Keep using Behavior
Trees where the project already has BT_/BB_ assets.
Core workflow
- Create the pair: a Blackboard (
BB_) holds typed keys (the AI's memory:TargetActor,LastKnownLocation,bIsInvestigating); a Behavior Tree (BT_) references that Blackboard. - Possess and run. An
AAIControllerpossesses the pawn and callsRunBehaviorTree(BT), which also initializes the referenced Blackboard. - Structure with composites. Selector runs children left→right until one succeeds (priority/fallback: "attack, else chase, else patrol"). Sequence runs children until one fails (do-all: "move to cover → reload → peek"). Simple Parallel runs one main task alongside a secondary.
- Gate branches with Decorators that read Blackboard keys (e.g. "Has Target?" guards the combat branch). Set Observer Aborts so the tree re-evaluates when the key changes.
- Keep the Blackboard current with Services attached to a branch — they tick periodically
(e.g. update
TargetActorvia a sight check) only while that branch is active. - Do work in Tasks, which return
Succeeded,Failed, orInProgress(latent tasks likeMoveTofinish later). - Verify with the Behavior Tree debugger during PIE — it highlights the running node and shows live Blackboard values, so you see exactly which branch executes.
Patterns
1. AIController that runs the tree (C++)
void AEnemyAIController::OnPossess(APawn* InPawn)
{
Super::OnPossess(InPawn);
if (BehaviorTree) // UPROPERTY(EditAnywhere) TObjectPtr<UBehaviorTree>
RunBehaviorTree(BehaviorTree); // initializes & uses the Blackboard the BT references
}
2. A priority tree (node structure)
ROOT
└── Selector (try combat, else investigate, else patrol)
├── Sequence [Decorator: Blackboard 'TargetActor' Is Set, Observer Aborts: Both]
│ ├── Task: MoveTo (TargetActor) // latent: returns InProgress then Succeeded
│ └── Task: Attack
├── Sequence [Decorator: 'LastKnownLocation' Is Set]
│ ├── Task: MoveTo (LastKnownLocation)
│ └── Task: Wait (3s) + clear key
└── Task: Patrol (BTTask_FindPatrolPoint -> MoveTo)
Observer Aborts: Both makes the combat branch interrupt patrol the instant TargetActor is
set, and bail out when it's cleared — this is what makes the AI feel reactive.
3. Updating the Blackboard from code (e.g. on seeing the player)
void AEnemyAIController::SetTarget(AActor* Target)
{
if (UBlackboardComponent* BB = GetBlackboardComponent())
BB->SetValueAsObject(TEXT("TargetActor"), Target); // key name must match the BB asset
}
// Clear with BB->ClearValue(TEXT("TargetActor")); to drop back to a lower-priority branch.
Pitfalls
- AI never starts — the pawn isn't possessed (set the Pawn's Auto Possess AI to "Placed
in World or Spawned" and assign the AIController), or
RunBehaviorTreewas never called. MoveToinstantly fails — no NavMesh in the level (add a Nav Mesh Bounds Volume), or the target is off the navmesh.- **Branch doesn't rea
Частые вопросы
Что такое блэкборд?
Блэкборд — это общее хранилище информации, например позиции игрока, которое читает дерево поведения.
Не стоит ли вместо этого использовать StateTree?
Скилл советует сначала уточнить у пользователя, так как обе системы есть в Unreal Engine 5.8, и проект может уже использовать одну из них.
Покрывает ли он математику поиска пути?
Не подробно. Движение использует навигационную систему движка, это отдельная тема.
Подробности
Оригинальное описание автора
Build NPC AI in Unreal Engine 5 with Behavior Trees and Blackboards: composites (Selector/Sequence), tasks, decorators, services, and running the tree from an AIController. Use when creating enemy/NPC AI, BT_/BB_ assets, custom BTTask or BTService nodes, or when the user mentions Behavior Tree, Blackboard, AIController, BTTask, decorator, or service.
Популярность
- Звёзды на GitHub
- 6.6k
- Место в рейтинге
- #13852
- Лицензия
- Apache-2.0
- Обновлён
- 28.10.2026
Комментарии
- …
Другие скиллы из этого репозитория
router
6.6kПомогает агенту выбрать нужный скилл для игровой разработки, определив движок и тип задачи.
ai-behavior-trees-utility-ai
6.6kПомогает агенту построить дерево поведения и систему утилитарного ИИ для врагов и персонажей игры, которые выбирают действия по приоритету и оценке.
audio-design
6.6kУчит агента сведению звука в играх: шины, громкость в децибелах, приглушение под диалоги, адаптивная музыка и вариации звуковых эффектов.
camera-systems
6.6kПомогает агенту создавать игровые камеры, которые плавно следуют за объектом, остаются в пределах уровня и вращаются или осматриваются в 3D.
Похожие скиллы
diffs
394kПозволяет агенту создать настоящее сравнение правок в виде ссылки или файла изображения, которым можно поделиться, вместо ручной сводки.
coding-agent
394kПомогает агенту передать большую задачу по коду в Codex, Claude Code или OpenCode как фоновому исполнителю, а затем проверять ее ход.
gh-issues
394kПомогает агенту находить задачи GitHub, выбирать, над какими работать, и открывать запросы на слияние с исправлениями, включая ответы на комментарии рецензентов.