-
Notifications
You must be signed in to change notification settings - Fork 195
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
[Proposal] Making it more "unreal" #10
Comments
|
Haven't seen many event-driven BTs around, can't really name any good ones :/ Funny, I had the same impression when I wanted to port unreal's BT over. As for the lack of parallel nodes in UDK, they did also mention that real parallel complicates BTs and makes things harder to debug, I can imagine this being true for complex cases..?
The goal I want to achieve is to have stateless nodes for maximum performance and optimal memory usage, but I guess there's still a long road ahead. Anyways, I'm not against the current design, I think it's nice and elegant. |
Hmm maybe I'm wrong, but I think this lib is pretty popular and event-driven. Back when I started NPBehave, I didn't find any too (even though the mentioned library should already been there). I just committed the changes I did to the debugger, so you don't need to repeat what I already did. I thought it would maybe be nicer when we would put all decorators together in one line? Or more inside the task label like in Unreal, I don't know ... I'm not sure how much our the |
Nice, I have Behavior Designer and nope, it's not event-driven. It uses messages to do few things, but at its core it still ticks like any other BT. I doubt the Btw, have you considered flattening your BT to one single array? UDK does it as well and this data-oriented design does have its benefits. |
oh ok, I didn't know that. I thought it's event-driven :/ so NPBehave seems to be pretty unique in that regard yay ;) One benefit of traversing through the service nodes in NPBehave is that they are started before the decorated node and execute their service-function already once there, ensuring that the service has been called at least once the decorated task or any subsequent decorators are called. And it also automatically stops when the decorated node stops. Of course you can do that in the implementation of a No I did not think about flattening yet. Why were you suggesting it? It could be helpful to reduce deep recursion stacks, I don't know. I didn't run into any performance issues yet, but that's good too keep in mind for possible optimisations. I guess this would mean a rather big change into the inner workings, but may be worth it. |
Yeah, flattening will completely get rid of recursion stacks, which will definitely be a pain to deal with if someone makes one of those deeply nested (dynamic) behavior trees. No particular reason for suggesting it, just thought that the case in that gamasutra article might end up in a stack overflow with the current nesting style, and also it's kind of cool in a way to have it in one dimensional array :) Anyhow, my agenda's been slowly filling up lately so I'll come back at some random point in the future. |
Is this still a thing? I've created a Wishlist for NPBehave 2.0, if you still think we need this, we should add this there, else we could just accept that NPBehave is not UE4 and close this ticket. |
One of the things I was trying to do myself is to replicate the way Unreal did their behaviour trees.
Since the structure was too different and I had the urge to use UniRx, I made my own repository and tried replicating it basing on how they did it in their SDK. I never managed to finish it but the structure and code is there, never got to implement UniRx either since I realized that it wouldn't benefit at all in the end.
What I found really interesting is the way they structure their trees.
Notice how service sticks underneath their composition node? Or how decorators are always above either composites and tasks?
Seeing how this looks:
https://camo.githubusercontent.com/40566eaf7697442c61b3f4079f70a83d479f51ab/687474703a2f2f6c6162732e6e6b7565626c65722e64652f6e706265686176652f696d616765732f4e504265686176652d416e696d2e676966
I can't help but to think it could be better, and by better I mean by changing the way it's structured.
The way they do it is not that hard.
Imagine if you could stack all nodes that share same scope.
Instead of :
You could have this:
In the end the structure for node class becomes like this :
The difference is that most logic is executed in the composites themselves, they're the ones who are active/inactive and know which child is currently active - not the task itself.
The children in the composite are stored with a struct
CompositeChild
, which looks like this:In order to execute the node you need to pass through its decorators, and in order to execute its services you need to execute the node. All this done by the composite parent.
Details aside, I really thought it through and it makes sense to structure it like that.
Seeing that Unreal kept it this way for so long with no other change can only mean that it works.
What do you think of it?
I know it's a major change but it would look totally awesome and the behavior trees will be more readable.
Anyhow, look up their docs and tell me if you agree with this. I think we could create something powerful.
The text was updated successfully, but these errors were encountered: