A javascript/typescript behaviour tree library implementation of Fluent-Behaviour-Tree
Table of Contents
Although there is another js/ts library for fluent-behaviour-tree, but it uses async/promise
to accomplish.
So I rewrite based on the origin C# implement. 🎉
- Pure ES5
- Tiny (~5KB Minified)
- Full Documented
- Zero dependency
npm install ts-behavior-tree
yarn add ts-behavior-tree
This library is supported with multiple formats (UMD, ES5)
You can get release versions of these from releases page.
You can find examples from test/BehaviorTreeBuilder.test.ts.
Here is a simple usage
import { BehaviorTreeBuilder, BehaviorTreeStatus, TimeData } from 'ts-behavior-tree'
const node = new BehaviorTreeBuilder()
.Sequence('aa')
.Do('aa', () => BehaviorTreeStatus.Failure)
.End()
.Build()
console.log(node.Tick(new TimeData()) === BehaviorTreeStatus.Failure)
git clone [email protected]:robinxb/ts-behavior-tree.git
npm t
: Run test suitenpm start
: Runsnpm run build
in watch modenpm run test:watch
: Run test suite in interactive watch modenpm run test:prod
: Run linting and generate coveragenpm run build
: Generate bundles and typings, create docsnpm run lint
: Lints codenpm run commit
: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)