A tool to declaratively define and generate behaviour trees in JavaScript. Behaviour trees are used to create complex AI via the modular heirarchical composition of individual tasks.

Using this tool, trees can be defined with a simple and minimal built-in DSL, avoiding the need to write verbose definitions in JSON.

In the example below we can see how a relatively small definition can be used to implement some basic AI for an enemy (red box) in order to chase a player when they move too close. Click on the grid and use WASD to control the player (purple box).

The tree definition for the above behaviour is shown below.

root {
    selector {
        repeat until(IsPlayerNearby) {
            sequence {
               wait [1000, 2500]
               lotto {
                   action [DoIdleChat]
                   lotto {
                        action [WalkUp]
                        action [WalkDown]
                        action [WalkLeft]
                        action [WalkRight]
                    }
                }
            }
        }
        sequence {
            action [OnPlayerSpotted]
            action [MoveTowardsPlayer]
            action [OnPlayerLost]
        }
    }
}