How can I parallel execute all sub-node in an iterate decorator?

NodeCanvas Forums Support How can I parallel execute all sub-node in an iterate decorator?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10472
    watsonsong
    Participant

    I am using NodeCanvas BehaviorTree to design actor skill in game.
    One skill is the actor launch number of projectile at the same time and make damage to monsters.
    Because the monster number is different, the projectile number is variable. I make a struct to description each hit information, including damage, hit, miss or crit. And I put each hit information into a list, put that list into the blackboard.
    I am using an Iterate to traval this list, but what I want is launch each projectile simultaneously. Right now it sequence launch projectile, move to one monster, hit and the monster play hit animation, damage label floating, blood spark and so on, wait all the thing finished, it launch the second projectile.

    But because I am using Iterate, it decompose each information into temporary blackboard variables. But the variables only have one copy, so I can not parallel execute all sub-node, even I writing a custom Iterate Node.
    Yes I can make the projectile into another behavior tree, but it tedious. Or I can manual expand the loop into three or forth copy of sub-tree, but it tricky. Beside it just one issue I met. I want to know WHAT IS THE RIGHT WAY TO PARALLEL EXECUTE A LIST NODE.

    How can I deal with this issue?

    #10479
    Gavalakis
    Keymaster

    Hello and sorry for late reply.

    The Iterator decorator node will execute it’s child node for each element in the same frame. As long as you don’t have any actions bellow the Iterator that return Running, all iterations will be done in the same frame (in parallel), without the need of a Parallel node.
    So the thing here is that you should no have any action beneath the Iterator that takes time to complete and as such this will make all projectiles be launced simultaneously.

    Is having an action beneath the iterator that takes time to complete a requirement?

    Thanks

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.