Releases: joeycumines/go-behaviortree
v1.8.0 - refactor(manager): improved NewManager implementation
Replaces the (optional) Manager
implementation, adding the ability to check errors (from added tickers) with errors.Is
, and provides ErrManagerStopped
, for identifying and handling failed attempts to add to a manager, that is stopping or stopped.
Otherwise, the new behavior resembles the old, as closely as possible.
The original motivator for this change was fixing an unhandled edge case, where a race between add and stop could lead to a deadlock. The new implementation is both more polished, and significantly more idiomatic.
v1.7.0 - feat(Switch): tick implementation like a switch statement
Adds a stateless Switch function that may be used directly as a Tick. Since all cases are defined as children, tick wrappers are typically compatible, notably including Memorize, which works as one might expect (see the example).
This release also changes the way Sequence handles invalid statuses, treating them as Failure rather than Success, which brings it in line with other implementations in this package, as well as it's own documentation.
v1.6.0 - feat(Context): provides context integration
I arrived on a solution to provide context support that I was happy to include in the core implementation. Peripheral, and entirely optional extra functionality, as usual. The new Context type simplifies context utilisation, via composition of basic building blocks.
v1.5.0 - feat(printer+values): fmt.Stringer, call frames, context-alike key-value support
The biggest change is the introduction of a mechanism to attach arbitrary values to nodes. This mechanism is entirely optional, although the New and NewNode factory functions will now automatically embed metadata about their caller. See also runtime.Frame.
behaviortree.Node now implements fmt.Stringer, using a text based tree structure similar to the GNU tree command. This behavior is configurable.
v1.4.0 - feat(Memorize): concise stateful sequence selector etc
Memorize is a stateful tick wrapper, as an alternative to the (admittedly, rather obtuse) Sync implementation, which wraps child nodes directly. Both implementations address the same core problem case; Memorize is simpler and more intuitive, and should be used unless the flexibility provided by Sync is necessary.
Also improves documentation, including a link to the academic paper that this simplified mechanism was modeled after.
v1.3.1 - refactor(sequence+selector): pass through errors unmodified
Error values will no longer be munged by Sequence
or Selector
. Previously, error messages were prefixed to include the child index. This behavior has proven itself to range from fairly useless to actively detrimental, due to log spam that may be generated, e.g. when propagating an error upwards through a large tree.
I also noticed I had flipped the comments somehow, oops.
v1.3.0 - Feature: Shuffle
Adds a single new function, Shuffle, which may be used to apply randomisation to a tick's child order, prior to each call. The source is customisable, but by default it simply uses the global math/rand.
v1.2.0 - Features: Any, All, Background
Adds the new stateless group tick Any, the stateful group tick wrapper All, and the stateful tick wrapper Background. The theme of this release is backgroundable long running tasks, and an example has been added which demonstrates a background job mechanism, utilising Sync and Async.
v1.1.1 - Bugfix: remove recover from Async
I missed a tick recover in Async when I removed this behavior from the NewTicker implementation.
Given it's undocumented and generally poor behavior, which is trivial to add as a caller, I am treating this as a bugfix.
v1.1.0 - Features: Fork, RateLimit, Not
Ports features from my working branch which have proven to be the most valuable. These are core building blocks that are very nice to have out of the box. Fork is a group Tick like Sequence and Selector, but is inherently stateful, unlike those other two. While the stateless pattern with optional statefulness via Async and Sync is very powerful, Fork should be easier to use. RateLimit makes it trivial to tick sub-trees at maximum rate, and is also a stateful Tick. Not simply inverts a Tick by flipping wrapping it and flipping non-error Success and Failure statuses.
These are stable 100% tested features which I am actively utilising in my own projects.