Description
Changelog
Reviews (0)

Missbehave

Behavior trees for Godot 4.7 / C#, authored in a visual graph editor.

A tree is a single .tres resource, edited entirely in the Missbehave dock: create nodes, wire them, reorder them, set their parameters, undo, save. The same graph colours itself live while the game runs, so you build a tree, press F5 and see what it does without switching views.

Features

Visual graph editor

  • Editor dock that can sit at the bottom or a side slot, or float in its own window (handy on a second monitor)
  • Trees grow top to bottom, with right-angled wires between a parent's bottom port and its children's top ports
  • Child order is the left-to-right order of the boxes, and a # badge on each box shows the resulting index
  • Searchable node picker, from a right-click or by dragging a wire into empty space
  • Arrange lays the tree out automatically without ever changing child order
  • Replace with… swaps a node's type in place and keeps its children, position and shared parameters
  • Disconnecting or deleting never loses work: detached nodes stay on the canvas as orphans and are still saved
  • Full undo/redo, copy/paste and Revert to go back to the saved file
  • Warnings (⚠) on boxes with configuration problems, plus a Validate button

Live debugging in the same graph

  • Success, Failure and Running are coloured right in the authoring graph
  • Nodes not reached this tick fade out, and animated dots flow along the wires into running nodes
  • Several actors on the same tree? Pick which one to watch from the toolbar
  • A paused game keeps showing its last tick
  • Cheap: one batched status array per tick, and only for the tree open in the editor

Typed blackboard

  • Every tree declares its values (name, type, default) in a blackboard panel beside the graph
  • Nodes use them through BbParam<T> members, either as a fixed value or linked to an entry
  • Entries are linked by id, not by name, so renaming an entry never breaks a node
  • Each BehaviorTreeRunner can override defaults and fill in scene nodes in its Inspector

One tree, many actors

  • A tree resource is a definition: shared by every runner, never ticked directly
  • Each runner builds its own runtime clone, so running children, cooldown timers and your own fields are never shared between actors
  • Exported resource references (e.g. a WeaponStats asset) stay shared, as you would expect

Nodes

Composites: Selector, SelectorReactive, SelectorRandom, Sequence, SequenceReactive, SequenceRandom, SequenceStar, SimpleParallel

Decorators: Inverter, Failer, Succeeder, UntilFail, Repeater, Limiter, TimeLimiter, Delayer, Cooldown

Leaves: your own ActionNode / ConditionNode subclasses, plus BlackboardSet, BlackboardErase, BlackboardHas and BlackboardCompare

Lists: ConditionListNode and ActionListNode fold several conditions or actions into a single compact box. The entries run top to bottom as a sequence or a selector, and each row lights up on its own while debugging.

Time-based decorators accumulate the tick's delta instead of reading the engine clock, so they behave the same on the idle and the physics thread.

Writing your own nodes

Subclass ActionNode or ConditionNode. Exported properties show up in the Inspector and are copied into every runtime instance automatically.

using Godot;
using Missbehave;

[GlobalClass, Tool]
[NodeGroup("Enemies")]         // listed under Action/Enemies in the picker
[NodeName("Follow target")]    // shown instead of the class name
public partial class FollowTarget : ActionNode {
    BbParam<float> Speed { get; set; } = 4f;
    BbParam<Node3D> Target { get; set; }

    protected override BehaviorStatus Run(BtContext ctx) {
        if (ctx.Actor is not Node3D actor) return BehaviorStatus.Failure;
        actor.GlobalPosition = actor.GlobalPosition.MoveToward(
            Target.Value.GlobalPosition, Speed.Value * (float) ctx.Delta);
        return BehaviorStatus.Running;
    }
}

Rebuild and the node appears in the picker. No restart needed.

Getting started

  1. Build the project (dotnet build), then enable Missbehave under Project → Project Settings → Plugins
  2. Create a new BehaviorTree resource in the FileSystem dock and double-click it
  3. Right-click the canvas to add nodes and drag from a bottom port to a top port to connect them
  4. Add a BehaviorTreeRunner node under your actor and assign the tree

A demo scene with two enemies sharing one tree is included in addons/missbehave/demo/.

Requirements

  • Godot 4.7, .NET build
  • A C# project. The addon compiles into your project's assembly and has no other dependencies.

If the very first enable reports a script error, restart the editor once and enable it again. This is a known rough edge of fresh C# editor plugins.

Tests

Two headless self-test suites, one for the runtime and one for the graph editor, both exit with 0 when everything passes.

Changelog for version 0.1.0

No changelog provided for this version.

Reviews

Missbehave has no reviews yet.

Login to write a review.

Consider supporting the creators!

If you enjoyed this asset consider supporting its creator. Follow the link below.