unreal-behavior-trees-sh-i2csbo

A dedicated skill for Unrealbehaviortrees that helps AI agents efficiently complete tasks related to Unreal Behavior Trees.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "unreal-behavior-trees-sh-i2csbo" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-72cd8f814cb3da391e3e6be67e4f4f7219964b687c4089cf891adf3e7030021c. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/unreal-behavior-trees-sh-i2csbo before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

A dedicated skill for Unrealbehaviortrees that helps AI agents efficiently complete tasks related to Unreal Behavior Trees.

0 Downloads

Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference

SkillPi interpretation

Tasks
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.4+**.
Audience
Use when building enemy/NPC AI: creating a `BT_`/`BB_` asset pair, structuring Selector/Sequence branches, adding decorators (conditions) and services (periodic updates), writing custom `BTTask`/`BTService` nodes, or wiring an AIController to run the tree. Use when the project has Behavior Tree (`BT_`) and Blackboard (`BB_`) assets and an `AAIController`. 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.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: Unrealbehaviortrees
slug: unreal-behavior-trees
version: 1.0.0
displayName: Unrealbehaviortrees
description: >
  Unrealbehaviortrees专用技能,帮助AI Agent高效完成相关任务。
  Unrealbehaviortrees专用技能,帮助AI Agent高效完成相关任务。
summary: "Unrealbehaviortrees专用技能,帮助AI Agent高效完成相关任务。"
license: Apache-2.0
category: 游戏开发
framework:
  - Claude Code
  - Codex
  - Hermes Agent
  - OpenClaw
  - QClaw
  - WorkBuddy
platform: multi-platform
homepage: "https://github.com/1991513ccie-png"
repository: "https://github.com/1991513ccie-png"

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.4+.

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 custom BTTask/BTService nodes, or wiring an AIController to run the tree.
  • Use when the project has Behavior Tree (BT_) and Blackboard (BB_) assets and an AAIController.

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.

Core workflow

  1. Create the pair: a Blackboard (BB_) holds typed keys (the AI's memory: TargetActor, LastKnownLocation, bIsInvestigating); a Behavior Tree (BT_) references that Blackboard.
  2. Possess and run. An AAIController possesses the pawn and calls RunBehaviorTree(BT), which also initializes the referenced Blackboard.
  3. 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.
  4. 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.
  5. Keep the Blackboard current with Services attached to a branch — they tick periodically (e.g. update TargetActor via a sight check) only while that branch is active.
  6. Do work in Tasks, which return Succeeded, Failed, or InProgress (latent tasks like MoveTo finish later).
  7. 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 RunBehaviorTree was never called.
  • MoveTo instantly fails — no NavMesh in the level (add a Nav Mesh Bounds Volume), or the target is off the navmesh.
  • Branch doesn't react to changes — the gating Decorator's Observer Aborts is set to None; set it to Self/Lower Priority/Both so the tree re-evaluates when the key changes.
  • A task hangs the tree — a custom task returned InProgress and never calls FinishLatentTask. Always complete latent tasks.
  • Blackboard key typos — SetValueAsObject("Taget", ...) silently does nothing; match the key name and type exactly, or use a cached FBlackboardKeySelector.
  • Sequence vs Selector confusion — Sequence = AND (stops on first failure); Selector = OR (stops on first success). Swapping them inverts the behaviour.

References

  • For a custom C++ UBTTaskNode (instant and latent ExecuteTask returning EBTNodeResult, with a FBlackboardKeySelector), read references/custom-bttask.md.
  • Primary docs: "Behavior Trees in Unreal Engine" (https://dev.epicgames.com/documentation/en-us/unreal-engine/behavior-trees-in-unreal-engine).

Related skills

  • game-ai — engine-agnostic AI design (FSM, BT, steering, pathfinding choices).
  • unreal-cpp-gameplay — the AIController and pawn classes in C++.
  • fps-shooter / tower-defense — genres that compose enemy AI.

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 专注于 Unreal Engine 5.4+ 行为树开发,提供从资产创建、控制器绑定到调试的完整工作流
  • 解决游戏开发中 NPC/敌人 AI 设计的明确技术痛点,受众精准
Trigger Precision92/100

Highlights

  • 触发词 'Unrealbehaviortrees专用技能' 精准明确
  • 'When to use' 章节清晰界定使用与不适用场景,边界清晰
Structure and Standards95/100

Highlights

  • 结构完整:包含使用场景、核心工作流、典型模式、常见陷阱、参考链接
  • 提供多个端到端代码示例(C++、树结构文本)和具体解决方案
  • frontmatter 完整,文档长度适中
Execution Reliability88/100

Areas to improve

  • 引用文件缺失 Reported severity: Minor

    SKILL.md 中引用了 'references/custom-bttask.md' 文件,但该文件未包含在传入的 ZIP 包中。

    Recommendation: 建议将引用的 'custom-bttask.md' 文件一并打包提交,或明确说明该文件为外部参考链接。

Highlights

  • 代码示例语法正确,参数使用合理(如 RunBehaviorTree、SetValueAsObject)
  • 覆盖主要异常场景(AI 不启动、MoveTo 失败、分支不响应等)并提供具体解决方案
  • 对常见陷阱(如键名拼写错误、Sequence/Selector 混淆)有详细说明
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

These common operations were not identified in the main document. This does not mean no permissions or risks exist.

Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • dev.epicgames.com
  • github.com

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.