npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@konghayao/blueshell

v1.0.1

Published

A Behavior Tree implementation in modern Javascript. Can use in browser.

Downloads

6

Readme

Blueshell

Blueshell is a Behavior Tree implementation written in Typescript.

It is synchronous for performance - asynchronous operations can be handled by returning async operations to your framework for evaluation, these can then generate new events to drive the behavior tree.

Circle CI

Node Types

Actions (aka Tasks or Execution Nodes)

Action

  • Handles the event normally and must return a result

Predicate

  • Executes a provided synchronous function ((state, event) => boolean) and returns SUCCESS or FAILURE based upon the boolean result of such function.

SideEffect

  • Executes a provided synchronous function ((state, event) => void) and always returns SUCCESS.

Success

  • Immediately returns SUCCESS when activated.

Composites (aka Control Flow Nodes)

Selector

(aka Priority or Fallback)

  • Sends an event to each child until one of them returns SUCCESS or RUNNING, then returns that value.
  • If we exhaust all the children, return FAILURE.

LatchedSelector

  • Sends an event to each child until one of them returns SUCCESS or RUNNING, then returns that value.
  • If we exhaust all the children, return FAILURE.
  • If a child returns RUNNING, subsequent events start at that child.

Sequence

  • Sends an event to each child until one of the returns FAILURE, or RUNNING, then returns that value.
  • If all children return SUCCESS, return SUCCESS.

LatchedSequence

  • Sends an event to each child until one of the returns FAILURE, or RUNNING, then returns that value.
  • If all children return SUCCESS, return SUCCESS.
  • If a child returns RUNNING, subsequent events start at that child.

IfElse

  • Accepts a conditional function a consequent node, and an optional alternative node.
  • If conditional(state, event) returns true, will return the result of activating the consequent node.
  • If conditional(state, event) returns false, will return the result of activating the alternative node, if one is provided.
  • If conditional(state, event) returns false, will return FAILURE if no alternative node is provided.

Decorators

Decorators intercept and can modify the event sent to or the result from the child.

Not

  • Returns 'FAILURE' when the child returns 'SUCCESS', and vice-versa

RepeatWhen

  • Repeats the child when an evaluation function returns true.

RepeatOnResult

  • Repeats the child if it returns the specified status.

ResultSwap

  • Allows you to swap one result of a child node for another.
  • For example, you can use this to mask FAILURE as SUCCESS.

Base Classes

Base

  • The base of all nodes.

Composite

  • The base class for all nodes which have children.

Decorator

  • The base class for decorators.
  • Can only have one child.

Publishing

  • The publisher can be registered with the tree which will log each transition.

Inspiration and Further Reading

The following are sources used when designing this library

Name

Blueshell is named for a Skroderider from the novel A Fire Upon the Deep by Vernor Vinge. Skroderiders are intelligent plants (trees) that use mechanical constructs to give them locomotion and short-term memory.

In other words, Blueshell is an intelligent tree. Or a tree with behavior. Get it?