Calamari / BehaviorTree.js

An JavaScript implementation of Behavior Trees.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Export tree to JSON

EnricoPietrocola opened this issue · comments

Is there an easy way?
Is it enough to JSON.Stringify my tree and feed it to an importer.parse?

(p.s. I'm sorry I'm uzi-ing all these questions! Know it's for the best as I'm prototyping the GUI I told you before! Thanks in advance for your help :) )

rata tatatatata*

uzi-ing… Interesting word :-D

No problem. No one forces me to directly reply, so I can do it to my own leisure. And it is always interesting to see what people use this for :-)

So, to understand you correctly: You programmatically build an BehaviorTree and now want to save it, so you can export it later?
Your best option here would be to write your own Introspector (one, that also notes down the NodeTypes and all the children of a branching node, that might not have run in that step).

The lib itself, only takes care of building and running a behavior tree. I think it should not care about how you manage your trees. I think that is a responsibility for another package. So basically, you would have to decide for yourself how you want to define and store your tree strctures, and then just load them into the tree and run them – where "loading them into the tree and run them" is the responsibility of thie package, and everything before that I don't think I can say how people should do that. Some people might be sufficient with a JSON/YAML/text-based description file, that they can just load, where you might need no tools, and I guess that should just work with the tools in this repo and the IDE/texteditor you have, and some people might need a GUI interface that handles that for them, and I did not have a sufficient urge to build one, since that can get out of hands quite quickly :-D

Does this answer your questions?

Absolutely right, I'll manage this myself then :) And I totally agree on the GUI getting out of hand quickly, now that I'm into it ahah.

I'll close the issue and I'd like to add a wip screenshot of the project to show you where I'm going. Still a lot to do but tonight I managed to make some simple music sequences with it. There are still some things to be developed and rules to be added on linking objects, but as long as I create the tree correctly it'll start running. Obviously when I'm done with the logic I'll completely recreate the styles.

I am trying to achieve something similar to what Unreal Engine 4 has, mainly to create a new music composition software, but I'll release a more generic editor as well since I make video games as well

screenshot