Download

Multiples behaviours tree running in parallel in IAController

I like behaviour tree, although the first time was a hell XXD, my first AI was a zombie type where the alien goes where you are and hits you and I saw everything perfect but …

Now I have started the AI of a drone, he needs a behavior to move and shoot and I have realized how rare it is for me to put both things on the same behavior tree.

Each one has a different “mission” with completely different tasks and decorators.

Being two such different behaviors it would be much more practical to have two separate behaviours tree.

Being small would be more manageable to work and as MieszkoZ says:

"And a bunch of simpler BTs will always be better CPU-performance-wise than one big & complex BT. Also, having many BT assets is no problem at all in terms of memory, so I’d recommend going that route. "

TD:RL

One AI mission = One behavior tree

for example the unreal shooter. Fire is in the end of a secuence node and first need to move.

It does not seem like something that interests me very much, I wonder if I’m missing something.

I have finished the movement behavior.

Really that it would not be normal to have a behavior to shoot and even one to dodge in that run simultaneously?

Will you fill this with parallel nodes hanging from all movements and stand nodes?

You can use multiple BTs with “Run Behavior” node. It allows to run BT inside another BT

Thanks for your help zeOrb

yes “Run Behavior” run another behavior, but It does not run simultaneously you have to hang it from a selector or a sequence.

The question is, how would you do now to decide which target to attack, which weapon to use?

It would not be good to have a separate behavior for it.

Right now I’m doing it at the ControllerAI itself and I miss all the good things about the behaviors tree.

If your “movement tree” and “attack tree” doesn’t work together, why you need to run together?
You should even want to run multiple trees simultaneously because you could end up with firing conflicting tasks. It’s no easier to manager than 1 bigger tree or switching between 2 small trees.

Also, your tree isn’t that complex. Running movement and attack together in this case would only add cost of checking single decorator like “is target active” :wink:

Now this is some serious BT:

Taken from the article at: http://www.gamasutra.com/blogs/TommyThompson/20181203/331725/Enemy_AI_Design_in_Tom_Clancys_The_Division.php

Yep, this is the problem of use a single behaviour tree, instead of parallel behaviours, I hope that the people of Snowdrop engine read this also. :wink:

It is not a question of size but of conception of design.
if with a small tree that already begins to smell what will happen when I make one more advanced
A behavior seems like the mind of a man, we only know how to do one thing at a time.
When you try to make a behavior tree do several things at once you find yourself in that chaos.

This is the “fake” behavior for Fire, running in parallel with the move behavior.

There can not be any conflict because one is responsible for moving and another is responsible for shooting, they do not have the same task.

Are you sure you can’t achieve what you want with simple parallel + run behaviour nodes?

There is official documentationabout how ue4 parallelism in BT differs from the usual one and it’s even stated how you can use these nodes to make basic shoot + movement

That’s actually super cool you can run 2 at the same time. Can they share a blackboard? So one can affect others decorators?
I understand there are methods to run BT inside a BT, or parallel tasks, but having multiple separate trees unlinked but using the same blackboard would mean you can swap completely behavior of an actor extremely fast by switching off one tree and turning on another.
With what is described in official documentation you can achieve similar results, but having more dependencies and harder time to swap parts of behaviour.
For example a sims-like the character could have a BT that drives it needs like eating drinking and sleeping… while another example of ai would not need any of those, but still run same movement logic.
Unless I am missing something? I am preparing to make an AI tutorial and don’t want to build it on false assumptions.