limboai
Use when using the LimboAI addon — behavior trees and hierarchical state machines (C++ GDExtension) with a visual editor, BTTask subclassing, and a blackboard
jame581 · 已有静态检查记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add jame581/GodotPrompter --skill limboai技能说明
name: limboai description: Use when using the LimboAI addon — behavior trees and hierarchical state machines (C++ GDExtension) with a visual editor, BTTask subclassing, and a blackboard
LimboAI
Related skills: ai-navigation for movement the tasks drive, state-machine for core-engine FSM (when you don't need an addon), godot-brainstorming for choosing an AI approach.
Addon: LimboAI · version
v1.8.0· Godot 4.6+ (GDExtension) · MIT · source: https://github.com/limbonaut/limboai · written in C++ (GDExtension; engine-module build also available). GDExtension exposes GDScript; C# requires the module build (not GDExtension in v1.8.0), and the v1.8.0 module build targets Godot 4.7.
1. When to use LimboAI
| Approach | Best for |
|---|---|
Core-engine FSM (state-machine skill) | Simple agents, < 5 states, no addon |
| Beehave (GDScript addon) | Lightweight BT, GDScript-only projects |
| LimboAI | BT and HSM together, visual editor, C++ performance, C# support (module build) |
Choose LimboAI when you need a behavior tree with a polished visual debugger, want to combine it with a hierarchical state machine (BTState bridges them), or need C++ task execution speed. Note: LimboAI requires Godot 4.6+ and is not usable on 4.3–4.5. For a simpler GDScript-only behavior tree, Beehave is a lighter alternative. For plain state machines without a BT, use the built-in state-machine skill instead.
2. Install & setup
GDExtension (recommended — no custom engine)
- Godot AssetLib → search "LimboAI" → Download → Reload project.
Or download from GitHub Releases and placeaddons/limboai/inres://addons/limboai/. - Enable the plugin: Project → Project Settings → Plugins → tick LimboAI.
- The
.gdextensionmanifest ships atres://addons/limboai/bin/:
[configuration]
entry_symbol = "limboai_init"
compatibility_minimum = "4.2"
[libraries]
windows.debug.x86_64 = "res://addons/limboai/bin/liblimboai.windows.editor.x86_64.dll"
windows.release.x86_64 = "res://addons/limboai/bin/liblimboai.windows.template_release.x86_64.dll"
linux.debug.x86_64 = "res://addons/limboai/bin/liblimboai.linux.editor.x86_64.so"
linux.release.x86_64 = "res://addons/limboai/bin/liblimboai.linux.template_release.x86_64.so"
macos.debug = "res://addons/limboai/bin/liblimboai.macos.editor.framework"
macos.release = "res://addons/limboai/bin/liblimboai.macos.template_release.framework"
# ... (additional platform entries for linux arm64/rv64, android, iOS, web)
GDExtension limitations: no in-editor documentation tooltips; BBParam property editor not available in the inspector.
Module version (C# or full editor integration)
Download pre-compiled editor + export templates from GitHub Releases. Requires the custom engine for export. v1.8.0 module builds are based on Godot 4.7 (GDExtension supports 4.6+). The module build ships a NuGet package for C#:
# Add local NuGet source to your project:
# dotnet nuget add source path/to/nupkgs --name LimboNugetSource
3. Behavior trees
A BehaviorTree resource holds the task tree. BTPlayer runs it each physics frame (or idle/manual). Add BTPlayer as a child of the agent node and assign a BehaviorTree resource.
GDScript
# EnemyAI.gd — assign behavior_tree in the Inspector or here
extends CharacterBody2D
@onready var bt_player: BTPlayer = $BTPlayer
func _ready() -> void:
# BTPlayer starts executing automatically (active = true by default).
# Connect to updated(status) to react when the tree finishes.
bt_player.updated.connect(_on_bt_updated)
func _on_bt_updated(status: int) -> void:
if status == BT.SUCCESS:
bt_player.restart() # loop the tree
C#
// EnemyAI.cs
using Godot;
public partial class EnemyAI : CharacterBody2D
{
[Export] private BTPlayer _btPlayer;
public override void _Ready()
{
_btPlayer.Updated += OnBtUpdated;
}
private void OnBtUpdated(int status)
{
if (status == (int)BT.Status.Success)
_btPlayer.Restart();
}
}
BTPlayer.UpdateMode controls when the tree ticks: IDLE (every _process), PHYSICS (every _physics_process, default), or MANUAL (call bt_player.update(delta) yourself).
4. Custom tasks
Subclass BTAction (multi-tick work) or BTCondition (immediate check). Annotate with @tool so _generate_name() and _get_configuration_warnings() work in the editor. Place scripts under res://ai/tasks/; subfolders become task categories.
GDScript
@tool
extends BTAction
## Moves the agent toward a blackboard position each tick.
@export var target_pos_var: StringName = &"target_pos"
@export var speed: float = 200.0
func _generate_name() -> String:
return "MoveToward %s" % LimboUtility.decorate_var(target_pos_var)
func _setup() -> void:
pass # one-time init; agent and blackboard are available here
func _enter() -> void:
pass # called when task transitions from non-RUNNING → RUNNING
func _tick(delta: float) -> Status:
var target: Vector2 = blackboard.get_var(target_pos_var, Vector2.ZERO)
if agent.global_position.distance_to(target) < 5.0:
return SUCCESS
agent.velocity = agent.global_position.direction_to(target) * speed
agent.move_and_slide()
return RUNNING
func _exit() -> void:
pass # cleanup after SUCCESS or FAILURE
@tool
extends BTCondition
## Returns SUCCESS if the agent is within range of a target node.
@export var target_var: StringName = &"target"
@export var distance_max: float = 150.0
var _max_sq: float
func _setup() -> void:
_max_sq = distance_max * distance_max
func _tick(_delta: float) -> Status:
var target: Node2D = blackboard.get_var(target_var, null)
if not is_instance_valid(target):
return
阅读完整来源 ↗