SDK: New Behavior Tree Editor


#1

I don’t commit to the SDK very often, but when I do, it’s awesome :wink:
Jokes aside, I spent the last month on refactoring @nehon’s awesome Shader Node Editor into a more general interface so the code could be re-used. It is now when his hard work pays out, so thanks for letting me stand on your shoulders there.

Before showcasing the Editor here, I shall put a warning:
.btree files are meant to be edited by humans with a text editor. When you use this Node Editor, it will REMOVE all Comments and OVERRIDE some of your style (e.g. the imports) AFTER the first save. It’s also NOT GUARANTEED that using the Editor wont RUIN your complete file. Especially in this state, don’t consider the editor save to use.

On the other hand: It’s a text file, so check it into git. You shouldn’t ever work with any software/editor without file backups actually. So do this please.

Limitations as of now:

  • Subtrees don’t work (because the Parser includes them transitively, so the editor sees the subtree as part of the main tree and would upon saving merge them into one giant file)
  • Editing Tasks is done through the Properties Panel. Unfortunately you have to select the Node in the Navigator (automatic selection from the editor doesn’t work), and the Navigator isn’t auto updated: If you add Nodes and it doesn’t appear, close the window and re-open it from Windows -> Navigator.

I’ll contact the netbeans team on advice for the second one, but the first one will stay so for a while unfortunately, but you could bypass 1 by always designing sub-trees and make the main trees by hand/code. Or just use a monolithic giant file like @Mithrin always loves to do :smiley:

This is the GDX “Dog” Example File:

Wanna start right now? Just use the New File Dialog to generate a .btree file.
Note that you have both, a code editor and a node editor. Saving changes in one overwrites the progress in the other.

Already have an existing tree not in textual format (@Mithrin)
Try https://github.com/jMonkeyEngine/sdk/blob/master/jme3-behaviortrees/src/com/jme3/gde/behaviortrees/BTreeExporter.java and related files (https://github.com/jMonkeyEngine/sdk/blob/master/jme3-behaviortrees/src/com/jme3/gde/behaviortrees/BTreeExporterUtils.java)
If you’re having trouble with exporting, let me know.

BTW: If you experience an exception you should see a new shiny Exception Report Dialog, this also happens when your Tree Code is faulty, though, so double check if it’s an issue on your side.

And if you don’t like the style of the nodes, contribute some icons (like parallel could be some parallel arrows etc pp) :slight_smile:


#2

Any plans to support UDK style highlights / animations while the tree is running ?


#3

I thought about it but that’d be another 30 days of work :stuck_out_tongue:
If I am so bad at coding AI that I need to debug it, I might think of a TCP based solution, but it’ll be quite a headache just only starting with play, pause, next frame controls (because everyone does AI differently since we don’t have a set API (like THE AIControl).

But probably not nowhere soon. The SDK side is ready for that (apart from uids for the individual tasks), but the game side…