Accessing sub-objects' variables, and updating variables passed to subtrees

NodeCanvas Forums Support Accessing sub-objects' variables, and updating variables passed to subtrees

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14920
    brad_bit
    Participant

    Hi! I’m getting started with NodeCanvas and a few questions rose up:

    1. I have a FSM on my Character class. The Character has a Weapon member, which has a WeaponTemplate member. Is it possible to access these sub-objects’ members via a Blackboard variable? For example, my WeaponTemplate has a value for determining character movement speed while firing, and I’d like to supply that as a parameter for the Character’s Move action while in a firing state. So far I’ve only come up with creating helper accessors directly in Character to access the sub-objects’ variables, but it would be handy to be able to access them directly. Is this possible?

    2. I have a FSM with a parallel task that collects user input. I tried to organize my FSM by splitting it into subtrees, and providing them with input values using Blackboard variables. This didn’t work out, since it seems the variables are only transmitted to the subtree once upon startup, and not continually. I had to replicate the parallel task in each subtree, which is inconvenient. Is there a way to update the subtree parameters after the tree has started?

    3. In a FSM, is it possible to advance through several states per tick? I have several states where I do simple initialization steps and could move on immediately, but I think they still take up a fixed update, which isn’t a lot, but it builds up and my FSM is handling fast-paced combo attack inputs, where timing is important.

    Thanks for the great tool! My code is already less noodley.

    #14930
    Gavalakis
    Keymaster

    Hello and welcome 🙂

    Please let me address your questions.

    1) It is not possible to access “deep” members right now unfortunately. Your way of creating accessors directly on the “root” Character object ins indeed the best solution right now. It is also good because you can bound that accessor to variables (Bound Variables) as well if you so require.

    2) Indeed sub-graph variable are updated only when the sub-graph starts (as well as ends) instead of updated per-frame. This of course is done for performance reasons, but since that has been suggested more than once lately, I am thinking of adding an “update per frame” option next to each variable in the inspector, so that we can selectively choose which variables to update per frame if any. Please let me know how this solution sound to you 🙂

    3) The FSM states (at least in NodeCanvas FSM) are by design meant to allow only one transition per frame (transitions are checked once per-frame), thus taking multiple transitions in one graph is not really possible with the current FSM design and changing the design to do so would really create some unwanted behaviour as well as potentially infinite loops (if valid transitions loop). As such, I can only but advice you to try and avoid this requirement. Maybe you can add your initialization tasks within the related state(s) ?

    Let me know 🙂
    Thank you!

    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.