[BUG] Swapping Subtree at runtime doesnt update variable

NodeCanvas Forums Support [BUG] Swapping Subtree at runtime doesnt update variable

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12654
    dyconic
    Participant

    Hi, me again.

    We are making a system that allows NPC’s to swap a subtree at runtime. The way this works is when an NPC meets a new Activity it has a subtree that gets this specifc activity plugged into it and gets the needed variables added to the blackboard. Now the subtrees have their variables dynamically linked to the blackboard. The first time our NPC gets an activity , it loads in the variables correctly. The second time he gets an activity that has the same behaviourtree however, the nodes don’t seem to update their variable to the newly linked dynamic variable.

    As an example: let’s say Activity 1 moves you to point A. and activity2 moves you to point B. both identical behaviourtrees, but differecnt variables ( dynamically linked to “destination” ).

    Activity1 gets executed first, and “destination” gets linked to point A. the NPC moves to point A correctly. now afterwards he goes to activity2. At this activity we get supplied a new subtree (which is identical to the previous one because same type of activity). “destination” now gets linked to Point B and we would expect the character to move towards B. he however still moves to A because teh node in teh subtree still uses the first variable instead of the dynamically linked “destination” which is now point B.

    If we pause the game here and open up the nodecanvas editor, then manually link the variable to “None” and then back to “destination” it now takes the correct value.

    Could you help us on this? It’s pretty frustrating and we can’t seem to figure out why this keeps happening. Could it have somethign to do with subtrees not getting the correct dynamically linked variables from their parent blackboard once these have been set ?

    Thanks in advance.

    #12655
    Gavalakis
    Keymaster

    Hello again.

    Thank you for your explanation.
    It seems to definitely have something to do with the dynamic variables not getting linked.
    Can you please clarify how are you supplying the new Behaviour Tree in your setup?
    Are you using the GraphOwner.SwitchBehaviour method, switching the Behaviour Tree of a SubTree, or some other way?

    Of course if it’s possible for you to send me a small reproduction example to support_AT_paradoxnotion.com, that would greatly help as well.

    Please let me know.
    Thank you!

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

    #12661
    dyconic
    Participant

    Our activities have a tree that defines their behaviour, this is put into a subtree on the main behaviour of the npcs that is dynamically linked. So whenever we change activity , we change the behaviourtree variable which is dynamically linked to the subtree node. Everything works fine when we swap to activities that have a different behaviour tree asset. However, when we switch to a different activity that has the same behaviourtree asset the variables don’t seem to be updated.

    Currently we have done a workaround where we manually delete the subtree node, duplicate it and link it again at runtime whenever we need to swap activities.

    #12664
    Gavalakis
    Keymaster

    Hello,

    Thanks for the follow up.
    I tried to somehow replicate the problem you are facing, but I unfortunately wasn’t able to do so. :/
    Is it possible for you to please send me a small reproduction problem showcasing this issue. I am really sorry, but I really can’t replicate the problem.

    Please let me know if possible.
    Thank you in advance!

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

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