跳过主要内容
ANY
Skill免费GameSkill 出品 · 调优版

Behavior Trees & Utility AI

/ai-behavior-trees-utility-ai

Build a behavior-tree runtime and a Utility AI system with response curves, plus hybrid agents where the behavior tree drives utility scoring.

许可证
Apache-2.0
出品
GameSkill 出品
下载 ZIP

所属合集

Awesome Gamedev Agent Skills

77 portable SKILL.md skills across 12 engines (Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox, Defold, Ebitengine), with a router.

我们测过

在 .NET 8 (C#) 上通过 40/40 项检查(2026-10-28):能触发、有可运行示例、有截图和自检清单、单一职责、中英文文档齐全。触发检查是把提示词和 skill 描述做匹配,不是真实 agent 运行。

测试报告

这个 skill 做什么

什么时候触发

Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators) and a Utility AI system (response curves — linear, exponential, sigmoid, quadratic …

GameSkill 测过的版本

GameSkill 调优版:skill 文件取自提交 184b72be0288,按我们的 skill 流程加上可运行示例、测试报告、自检清单和中文指南。

协议:基于 gamedev-skills/awesome-gamedev-agent-skills(作者 gamedev-skills),协议 Apache-2.0。ZIP 保留协议文件(LICENSE, NOTICE),CHANGES.md 列出了 GameSkill 加的所有文件。

Behavior Trees & Utility AI

自检清单

  • 每个节点只返回 Success、Failure、Running 三种状态 / Every node returns only Success, Failure or Running
  • 被打断的分支会调用 Reset,清掉计时和动画 / An aborted branch gets Reset, clearing timers and animations
  • 冷却装饰器不在 Reset 时清零,避免反复进出分支时连击 / Cooldown is not cleared by Reset, so flickering branches can't spam attacks
  • 效用分数都在 0 到 1,多个因素相乘后做补偿,0 仍是一票否决 / Utility scores stay in 0..1; products are compensated and a 0 still vetoes
  • 选择加了惯性(hysteresis),分数接近时不来回切换 / Selection has hysteresis, so near-ties don't flip back and forth

中文指南

这个 skill 做什么

教 agent 写一套可复用的行为树运行时(黑板、条件和动作叶子、顺序/选择/并行组合、装饰器)和效用 AI(响应曲线、考量因素、动作评分与选择),以及两者混用:行为树决定“要不要打”,效用 AI 决定“怎么打”。代码是 C#,Unity 和 Godot C# 都能用。

什么时候用

  • 敌人或 NPC 的决策超出了简单状态机
  • 需要可打断、可复用的 AI 行为
  • 想让 NPC 按需求(饿、累、孤独)自己选择做什么

怎么装

下载本页的 ZIP,把 ai-behavior-trees-utility-ai/ 整个文件夹放进 .claude/skills/(Claude Code)或 .agents/skills/(Codex、Cursor),重启 agent。

最小示例

gameskill/examples/ 是一个 .NET 8 控制台项目:extract.py 把 skill 参考文件里的 22 段 C# 原样拷出来编译,Shims.cs 补上 Unity 的 Vector2 等少量类型,Program.cs 是测试。

我们怎么测的

用 .NET 8 编译并运行 skill 自己的代码,28 项检查全部通过:黑板类型安全;顺序和选择节点能从 Running 的子节点继续;响应式选择和响应式顺序会打断并 Reset 低优先级分支;并行策略、取反、强制成功、重复、等待都正确;冷却在分支 Reset 后仍然有效;巡逻守卫看到玩家后追上去,2 秒内按 0.8 秒冷却攻击 2–3 次;曲线端点、S 曲线中点、反向区间、补偿都正确;村民饿了吃饭、夜里累了睡觉;惯性让分数小幅下降时不切换;softmax 偏向高分但不总选它,温度极小也不溢出;混合树近身用近战、10 米外用远程。结果在 gameskill/test-report.json。

搭配

  • game-ai:先决定用状态机、行为树还是转向行为
  • level-design:按关卡节奏安排敌人
  • physics-tuning:AI 移动要和物理步长一致

安装

告诉你的 AI

Install the skill from https://gameskill.dev/skills/ai-behavior-trees-utility-ai/install.md

GameSkill 测过的版本

测过的版本装到 .claude/skills/
mkdir -p .claude/skills
curl -fsSL https://gameskill.dev/dl/skills/ai-behavior-trees-utility-ai.zip -o /tmp/gameskill-ai-behavior-trees-utility-ai.zip
unzip -oq /tmp/gameskill-ai-behavior-trees-utility-ai.zip -d .claude/skills
rm /tmp/gameskill-ai-behavior-trees-utility-ai.zip

包含内容

  • A pitfalls section with the mistakes to avoid
  • Bundled 4 reference docs the agent reads when needed

适合

  • Implementing a reusable behavior-tree or utility-based decision system
  • Tuning enemy/NPC decisions beyond a simple FSM

不适合

试试这条提示词

提示词
Build a reusable behavior tree with a blackboard for my enemy, then add utility scoring to choose its attacks.

关于这个 Skill

Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators) and a Utility AI system (response curves — linear, exponential, sigmoid, quadratic — considerations, and action evaluators), plus hybrid BT-drives-Utility agents. Use when implementing a reusable behavior-tree or utility-based decision system, or tuning enemy/NPC decisions beyond a simple FSM, or when the user mentions behavior tree, blackboard, decorator, selector, sequence, tick status, utility AI, response/scoring curve, or consideration. For choosing between FSM/BT/steering or for pathfinding, use game-ai; for Unreal's BehaviorTree/Blackboard assets, use unreal-behavior-trees.

From the ai-behavior-trees-utility-ai SKILL.md in gamedev-skills/awesome-gamedev-agent-skills.

What's inside

  • Architecture at a glance
  • Utility scoring in one snippet

常见问题

同赛道 PRO 商业源码$8.25/mo

肉鸽战斗与首领套件 Roguelike Combat & Boss Kit

拆自《招式武林》的 6 大战斗与首领商业内核(同步交付 JS/TS + Godot 4 .gd + Unity .cs 三端源码):Boss 半血变身三段锁血、防守表现分动态怒气、确定性双通道暴击、丝血反杀暗箱、破防状态机与正向遗物总线,附可玩 60fps Canvas 沙盒。

  • EP28 Boss 变身锁血:单次门槛、45 血硬卡、送盾绝不回血 + 换招升级
  • EP27 防守表现分怒气 + EP26 确定性双通道暴击(告别 55.2% 连黑 5 次)

基于 gamedev-skills/awesome-gamedev-agent-skills (作者 gamedev-skills,协议 Apache-2.0)。ZIP 里保留原作者的 LICENSE 和 NOTICE,ATTRIBUTION.md 和 CHANGES.md 写明来源提交和 GameSkill 加的内容。

搭配使用

作者标注的相关 Skills,或更适合相邻任务的 Skills。

Awesome Gamedev Agent Skills 中的更多 Skills

查看全部 43 个

相似 skills

Agent Sprite Forge
GDT
Skill
4.9k

Agent Sprite Forge

Five agent skills that turn one approved character still into a game-ready sprite set: one image-to-video clip per action, then deterministic Python tools key, register, loop, retime, palette-lock and export it for Godot, Aseprite and the web. Also maps, tiles and code-drawn art.

GodotWeb (Phaser / Three.js)Engine-agnosticClaude Code · Codex
earshot
ANY
Skill
GameSkill 出品

earshot: ears for coding agents (judge, find, time-align and make game sound on CPU)

Let an agent hear: rank sound-effect candidates against a description, find the clean trim in a long recording, tell real recordings from code-synthesised sound, check that every hit lands on its picture cut, and render effects from a bank of 252 code-made sounds. Runs locally on CPU with two open audio models (~1.1 GB, downloaded once); no API key needed.

Engine-agnosticClaude Code · Codex +3
One Sentence to Game
WEB
Skill
GameSkill 出品

One Sentence to Game (prompt, iterate, check)

A GameSkill original for any model: a round-1 prompt that turns one sentence into a small finished browser game, a one-change-per-round loop with a creation log, a reusable spec template, and a headless checker that reports console errors, blank frames and dead controls as PASS or FAIL. It does not promise one-shot.

Web (Phaser / Three.js)Engine-agnosticClaude Code · Codex +2
Playtest Report
ANY
Skill
GameSkill 出品

Playtest Report (Claude Code Game Studios)

Structured playtest report template, or turn existing playtest notes into structured feedback.

Engine-agnostic来自 Claude Code Game Studios