Socket
Socket
Sign inDemoInstall

behavior3-chief

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

behavior3-chief

Manage and run behavior trees for your subjects in your game


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Behavior3 Chief

Manage and run behavior trees for your subjects in your game

npm GitHub license Travis Coverage Status David

Chief is a simple wrapper around JavaScript library Behavior3. Main reason for its creation is to have a unified place for managing behavior trees, nodes and subjects.

A behaviour tree is a tree of hierarchical nodes that control the flow of decision making of an AI entity. At the extents of the tree, the leaves, are the actual commands that control the AI entity, and forming the branches are various types of utility nodes that control the AI’s walk down the trees to reach the sequences of commands best suited to the situation.

Quoted from the article

Subject is an invention of the Chief. It represents a single entity that runs a single behavior tree. Its memory and status can be easily accessed. This helps to build better development tools or even to watch tree running in a real game.

Installation

	npm install -S behavior3-chief

Usage

Chief exports single factory function to create instance of its API object.

	import Chief from 'behavior3-chief';
	const chief = Chief.create();

Behavior nodes

Chief registers known built in nodes when created. Any custom nodes has to be registered with registerBehaviorNode method which accepts node descriptor. Specifying globally unique name for nodes is obligatory as such name is used when constructing new node instances.

To see list of currently registered behavior nodes, use listBehaviorNodes method which returns simple collection like following:

	[
		{ name: 'Failer', category: 'action', parameters: null },
		{ name: 'MaxTime', category: 'decorator', parameters: { maxTime: 0 }}
	]

Node descriptor

Fully pluggable (composable)

Chief is built using stamps. That makes it pluggable almost by default. Exported stamp of Chief can be easily composed further before creating its instance.

	import Chief from 'b3-chief';
	const BetterChief = Chief.methods({
		findSubjectByName(name) {
			return this.listSubjects().find((subject) => subject.getName());
		}
	})

	const chief = BetterChief.create();
	chief.findSubjectByName('Master');

This gives you amazing flexibility in everything. You can easily add various methods and properties there instead for your own use or perhaps create plugin library that just exports the stamp to be composed there.

FAQs

Package last updated on 10 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc