Giter Club home page Giter Club logo

bonsaibehaviourtree's People

Contributors

gitter-badger avatar luis-l avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bonsaibehaviourtree's Issues

selector branch are not reevaluated?

https://gyazo.com/7f2363ea32ec669d66baea3aa477be18

in this example i want the combat branch to run if the value has player is true.
the tree start with value true so it run the left side of the branch.
i change to false then the selector will run the idle task on the right
but when i change it back to true then the left side "combat branch" is not evaluated again.

how can i fix this? other behavior tree i used got this behavior working

ArgumentNullException: BonsaiBehaviourTree/Editor/BonsaiCanvas

WTR:

  1. Create tree
  2. Add custom node
  3. Rename or delete custom node
  4. Open bonsai designer

ArgumentNullException: Value cannot be null. Parameter name: key System.Collections.Generic.Dictionary2[TKey,TValue].FindEntry (TKey key) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Collections.Generic.Dictionary2[TKey,TValue].get_Item (TKey key) (at <695d1cc93cca45069c528c15c9fdd749>:0) Bonsai.Designer.BonsaiCanvas.ReconstructEditorConnections (System.Collections.Generic.Dictionary2[TKey,TValue] nodeMap) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:214)
Bonsai.Designer.BonsaiCanvas..ctor (Bonsai.Core.BehaviourTree tree) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:28)
Bonsai.Designer.BonsaiEditor.SetBehaviourTree (Bonsai.Core.BehaviourTree tree) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiEditor.cs:360)
Bonsai.Designer.BonsaiWindow.BuildCanvas () (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiWindow.cs:218)
Bonsai.Designer.BonsaiWindow.OnGUI () (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiWindow.cs:92)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <63ccfe108ffa44728b417cb47fb2f841>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <63ccfe108ffa44728b417cb47fb2f841>:0)
UnityEditor.DockArea.OldOnGUI () (at <63ccfe108ffa44728b417cb47fb2f841>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <3b9216b5eb2547d2a9ee9f63fc12b7c2>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)`

Implement Undo

The editor should have its own undo structure, so it does not interfere with Unity's undo.

Ideally, control+u would be the default undo action trigger. Unsure if it is possible to prevent Unity from also using control+u after the BonsaiEditor uses it.

I think a persistent data structure could be used as the underlying mechanism for undo. This will store state for every tree change. Undo/Redo will simply be moving up or down a list which stores copies of the persistent data structure.

Add for description of ConditionalAbort

If you add a description to ConditionalAbort by inheriting from Description, there is not enough spacing between the description of the base class and the description of the inheritor.

good way to add bt owner reference in blackboard?

Here is an example condition:
namespace Bonsai.Standard { [BonsaiNode("Conditional/", "Condition")] public class HasEnemy : ConditionalAbort { public override bool Condition() { var character = Blackboard.Get<BaseCharacter>("baseCharacter"); return character.Target != null; } } }

do you have an example how to initialize that blackboard so it is correctly instanced with its owner so each unique character have their own instance of blackboard.

also if i assign the same scriptable BT to 2 different character, will they share the same scriptable BT or make instances?

feature: Comparator Nodes

Comparator feature.
A comparator takes values from two child nodes and compares them.
Usage examples:
Calculating the distance between two objects.
Any arithmetic operations.

This also includes Getter nodes. They fetch objects and classes from the external world.
Usage examples:
Fetching the player object to later check the distance.
Set and Get variable to/from Blackboard
Since the blackboard doesn't allow linking references from outside, and since the entire tree gets duplicated, resulting in a 'Type mismatch' + blackboard cannot be viewed during execution, Getter nodes solve this problem.

Remove the need for temporary save directory

When creating a new Behaviour Tree from the editor, it creates and saves the new asset in a specified temporary directory that cannot be changed.

The directory is also useless. Temporary(unsaved) trees are immediately removed when entering play mode or closing the window.

When creating a new tree for the first time, it should not be saved any where. Saving only occurs when the user does a Save/SaveAs action.

The object you want to instantiate is null

After restarting a scene where I had built two trees with custom nodes, one of them doesn't work anymore. Upon Entering Play Mode I get this error :
ArgumentException: The Object you want to instantiate is null.
UnityEngine.Object.CheckNullArgument (System.Object arg, System.String message) (at <29ad182faa3f478c9310d6a2e7143c15>:0)
UnityEngine.Object.Instantiate[T] (T original) (at <29ad182faa3f478c9310d6a2e7143c15>:0)
Bonsai.Core.BehaviourTree+<>c.b__39_0 (Bonsai.Core.BehaviourNode n) (at Assets/BonsaiBehaviourTree/Core/BehaviourTree.cs:340)
System.Linq.Enumerable+SelectArrayIterator2[TSource,TResult].ToArray () (at <351e49e2a5bf4fd6beabb458ce2255f3>:0) System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable1[T] source) (at <351e49e2a5bf4fd6beabb458ce2255f3>:0)
Bonsai.Core.BehaviourTree.SetNodes (System.Collections.Generic.IEnumerable`1[T] nodes) (at Assets/BonsaiBehaviourTree/Core/BehaviourTree.cs:118)
Bonsai.Core.BehaviourTree.Clone (Bonsai.Core.BehaviourTree sourceTree) (at Assets/BonsaiBehaviourTree/Core/BehaviourTree.cs:340)
Bonsai.Core.BonsaiTreeComponent.Awake () (at Assets/BonsaiBehaviourTree/Core/BonsaiTreeComponent.cs:22)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.HostView.Invoke (System.String methodName) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEditor.DockArea.OldOnGUI () (at <7d90b28560b644ce87b8263efcc36eed>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <06214b245dbb4d10a9cefd10639bb04e>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

It's quite annoying because there was quite a lot of work there, and now I can't even open the graph. I don't know if this because of some nodes I made, but it worked perfectly when I closed Unity a few hours ago...

Make Conditional Aborts Composites

Hi, would you be able to make ConditionalAbort inherit form Composite instead of Decorator so that aborts cave have multiple children. This will reduce the amount of duplicated ConditionalAbort across branches.

So instead of this:
image

We can have this:
image

Allow Extended Selection mode for nodes in editor

The only multi-selection available in editor is the area selection.

Main Task

Multi-selection should also work by clicking nodes. e.g. control+click to add/remove nodes from selection group.

Extra

This could also be extended to multi-select nodes in a "range" (e.g. shift+click). For example, select all nodes under a branch with the same level-order, or all nodes between parent and click child (depth-first path)

Though this could be handled by area selection for most use cases.

Package Manager Support

Hi, would it be possible to add Unity's package manager support for easy updating straight from the git repository? Thanks for a great asset btw!

Implement Change Type for nodes in editor

The Change Type action is not implemented.

Change Type changes the underlying BehaviourNode represented by the BonsaiNode.

Conversions can only be done for behaviours of the same base type:

  • Composite to Composite
  • Decorator to Decorator
  • Task to Task

Conversion need to preserve all input and output connections.

Tests folder error

hi, i had to delete the "Tests" directory because of compilation errors (also if i added the package NUnit)
it would be nice if it was in a test branch or something alike.. so that we can add this framework as a git submodule without major issues

so good, about demo.

hello, is there any unity sample to show the features that display in the screenshot / videos, it will help us how to use quickly, thanks.

Needs better documentation

Hi,
first of all, good work so far. I could easily get started with latest unity and create a simple tree.
I could also create a custom task using your example from the readme. One problem I have is how a task can be written for a specific game object. Since tasks are scriptable objects this doesn't seem to be so simple. (I could probably find the object and perform some action (e.g. using the navigation agent to move to a new target), however this would be very slow.
I'm sure that I must be doing something wrong but I feel that either adding some more advanced examples or writing a documentation would help. (I know it's still in progress and these things might be already planned, but I'm just impatient).
regards

bt asset can get corrupted

  • create a bt asset
  • select the asset, open the editor, dont save it
    -run the scene and make a gameobject use the bt

the asset in result will be corrupted

NRE when opening a tree in Bonsai Designer

  1. Create a tree
  2. Create a custom node
  3. Add it to the tree
  4. Remove the custom node

NullReferenceException: Object reference not set to an instance of an object Bonsai.Designer.BonsaiCanvas.CreateNode (Bonsai.Core.BehaviourNode behaviour) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:49) Bonsai.Designer.BonsaiCanvas.ReconstructEditorNode (Bonsai.Core.BehaviourNode behaviour) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:198) Bonsai.Designer.BonsaiCanvas.ReconstructEditorNodes (System.Collections.Generic.IEnumerable1[T] behaviours) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:189)
Bonsai.Designer.BonsaiCanvas..ctor (Bonsai.Core.BehaviourTree tree) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiCanvas.cs:27)
Bonsai.Designer.BonsaiEditor.SetBehaviourTree (Bonsai.Core.BehaviourTree tree) (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiEditor.cs:360)
Bonsai.Designer.BonsaiWindow.BuildCanvas () (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiWindow.cs:218)
Bonsai.Designer.BonsaiWindow.OnEnable () (at Assets/3rdParty/BonsaiBehaviourTree/Editor/BonsaiWindow.cs:61)`

Refactor out Tree Meta Data (Graphical) from the Core classes

The BehaviourTree and BehaviourNode classes store Tree Meta Data.

The meta data is defined inside UNITY_EDITOR blocks and stores information such as Node Position, Pan, Zoom, etc. This meta data is only relevant to the BonsaiDesigner.

This was initially done so data was centralized in one place and serialized along with the ScriptableObject.

The data should be moved outside the core classes.

An approach can be storing all this data in a separate ScriptableObject (TreeMetaData class). This object would be added under the BehaviourTree asset object so all data is centralized. In play mode, the tree instance running will not use this data at all.

Colorblind options

Even though there is text and icons to identify nodes, colorblind options could still be useful to quickly differentiate node types and ports.

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.