GithubHelp home page GithubHelp logo

joeycumines / go-behaviortree Goto Github PK

View Code? Open in Web Editor NEW
59.0 4.0 8.0 112 KB

Package behaviortree provides a simple and powerful Go implementation of behavior trees without fluff.

License: Apache License 2.0

Go 100.00%
behaviortree golang ai robotics bot bot-framework go behavior-tree state-management state-machine closure game-ai behavior-trees behaviour-tree behaviour-trees fsm

go-behaviortree's Issues

Other Composite and Decorator Nodes

Is your feature request related to a problem? Please describe.

I'm new to BT but one thing I've seen is that there are much more Composite nodes than the Sequence and Selector, for example Random Selectors / Sequences.

And there are also the Decorators:

  • Inverter: Simply put they will invert or negate the result of their child node.
  • Repeater: A repeater will reprocess its child node each time its child returns a result. These are often used at the very base of the tree, to make the tree to run continuously. Repeaters may optionally run their children a set number of times before returning to their parent.
  • Succeeder: A succeeder will always return success, irrespective of what the child node actually returned.

For what I read there much more but those look like the main ones also

Describe the solution you'd like

To consider the option of adding them

Describe alternatives you've considered

As long as you are ok on adding them I could take a look into doing it myself :)

Additional context

Another GO lib that has some of the Composites and Deocrators: https://github.com/askft/go-behave?tab=readme-ov-file#composite-nodes

A blog also mentioning some of those https://www.gamedeveloper.com/programming/behavior-trees-for-ai-how-they-work

As I said before, anyone can add anything but looks like those are common.

project roadmap

@joeycumines
Thanks for giving us go-behaviortree. IMHO this is the best implementation.
Do you plan to continue with this project?
I have some enhancements and was wonder if I should fork or submit PR.

Sequence should not tick previous children if a children returns Running

Hi, I have recently started using this library and I wanted to thank you for the amazing work.

I have the following BT. The logic I am trying to implement is making the ship extract resources and sell those not wanted until full. The extract resources action has a cooldown so its sibling node first checks if the cooldown is active and returns running if so:

	return bt.New(bt.Sequence,
		Sell(ship, sellExceptions...),
		bt.New(bt.Sequence,
			bt.New(func(children []bt.Node) (bt.Status, error) {
				if time.Now().Before(ship.Cooldown.Expiration) {
					return bt.Running, nil
				}
				if ship.Cargo.Units == ship.Cargo.Capacity {
					return bt.Failure, nil
				}
				return bt.Success, nil
			}),
			Extract(ship),
		),
	)

From what I understand about Behavior Trees, I expected the outer sequence node to directly Tick its second child (that is the inner Sequence node), since it returned a Running Status. Is this the expected behavior in your implementation? If so, how can I implement the behavior I described?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.