-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Behavior tree renovation / documentation [$100] #2070
Comments
I am experimenting with the current state and implemented some smaller fixes & refactorings for the system, all in small commits at https://github.com/oniatus/Terasology/tree/behavior.
Edit: Fix link |
Hi @oniatus, and thank you for looking into this. A bit of a side question: how abstract or tightly integrated is the visual display of the behavior tree? I mean: could the graph/nodes be easily used for something completely different? We have been discussing a node-based approach to the rendering pipeline and I've been wondering if the behaviour tree display could be used to display the steps in the rendering pipeline instead. At this stage I'm just curious about this though, nothing to rush about. |
@emanuele3d : The rendering is fully decoupled from the internal behavior nodes. The otlb.nui package contains the rendering stuff. The tree + nodes are inside the tree package. Asset package contains code to load trees - also there is some code to create a tree for rendering from a behavior tree structure. Evaluating a tree should be possible without any code from the rendering stuff. @oniatus : Thanks for looking into this topic ;-) The basic idea is, entities with behavior should have a BehaviorComponent with a link to a behavior tree. This tree is decoupled from terasology entity system (the tree itself is not an entity). However, the rendering code itself is an experiment ;-) Its quite difficult to implement modifications in the underlying tree, especially because you may have to reorder children lists and such things. Another implementation of a behavior tree system I made, can be found here. There are also some tests, to get an idea how it works. The main difference to the current terasology implementation is, it has the ability to compile a behavior tree to bytecode (which is a gigant switch/loop thing, encapsulated in a class). Then, for each entity, an instance of this (generated) class is created, instead of a deepcopy of the behavior tree. But I really dont know, if this is needed in any way. There is a outdated and half done integration of this system into terasology. The main problem is, how to implement the actual nodes (ie movement) in a way, that integrates nicely with the terasology entity system. |
There you are! /me attempts to lasso @synopia Appreciate you adding in some feedback. We still aren't locked down for v1.0.0/alpha (running late as expected) so if at all you find more time please heeeeelp! :D @oniatus thanks for the updates. Any progress is progress and I'm sure there's much to do :-) @emanuele3d you mean like showing the pipeline with TeraEd active, maybe even edit it on-the-fly to have effects applied in different sequence? That'd be sweet |
@synopia Thanks for the explanation :) I uploaded some more changes, e.g. it is now possible to create a plain new tree and I refactored some fields/javadoc. However, this breaks the current api, I am updating my Pathfinding fork in parallel for testing: behavior branch. |
@oniatus - great! Keep it coming and don't worry about breaking API. If we can have a new stable version here within a week or two we can grab it for the engine v1.0.0 / game alpha release. Not by any means a final version or anything, just a sensible API level we can call a foundation to build on later :-) |
@synopia: Thank you for your reply! @Cervator: initially I'd use it for debugging purposes, to make sure visual data is flowing through the pipeline in the right way. Eventually it might be useful for modules adding nodes to the rendering pipeline: it might be impossible for a module to programmatically determine where to attach its nodes, especially if the rendering pipeline has been already customized by other modules. But the author of a module could have published configuration instructions that a human being would be able to fullfil, even if the pipeline is no longer standard. And ultimately yes, each node might have a number of settings that the user could configure on the fly. |
Sounds great! Now we just need to make it happen, heh :-) |
I'm looking into possibly getting this into a working (& documented) state for my GSoC project. @oniatus as you seem to be working on this presently, do you think you could use a dedicated helping hand with lots of time to spend on the BT/AI rework? I'd be learning the ropes for a few days but then I think I could be of solid assistance, with both the internals and the GUI. |
@dkambersky Absolutely :) My personal goal is to get the system in a state where it is usable without crashing and maybe writing some short tutorials for it on the wiki. Aftwerwards I would like to step to another part, maybe the world generator or the ui as I want to get a deeper understanding of the whole thing, not only pathfinding/behavior. |
Added two PR: #2199 and Terasology-Archived/Pathfinding#23. @Cervator Let me know if I can provide any further assistance. |
Further assistance is always appreciated and needed hehe :D I left you some notes in the PR. Thanks! And yep so long as we can stabilize that PR that should be a good foundation for this topic in GSOC :-) |
I've implemented the Behavior Trees in my game project, feel free to take it and use it under whatever license you are using. You'd have to copy/paste the code into a module in Terasology and of course point the classes to correct injection of systems, registering of systems and the entity system classes, plus scanning+loading of behaviors. The link is: |
I'm going to close this as completed as part of release management fun for Alpha 8 / end of GSOC 2017. The code isn't actually part of Alpha 8 since it is targeted for engine v2.0.0 - but that's close enough to finish this one item out, let the bounty be claimable, then get started on writing more detailed follow-up issues soon Thank you very much for your work @dkambersky! And mentors + other participants on this issue and topic for years now :-) GitHub project board over here https://github.com/orgs/Terasology/projects/7 and blog at https://dkambersky.github.io/tera/2017/08/24/google-summer-of-code-2017-final-report.html |
Edit: Actually heard from @synopia and should know more at the end of December
We've long had our behavior tree based AI thanks to @synopia but it hasn't moved some for quite a while. With the big v1.0.0 coming up I've been hoping to get some more tweaks applied along with a tutorial of some sort. Additionally Synopia actually worked on a v2 of behavior trees that lived mostly in a module. Ideally we'd get that dusted off and brought in as it seemingly came with a lot of improvements.
Two different scopes here. Naturally I'd prefer the bigger scope and for @synopia to come claim this, but it has been hard getting in touch :-)
Fine tune the existing setup in engine
I would consider this sufficient to claim the bounty I aim to put on here.
Finish the new system
This would likely be worthy of GSOC for the added scope, and because GSOC is coming soon. None of these items are required for the bounty and are each optional bonuses (so enough of them == GSOC)
The text was updated successfully, but these errors were encountered: