Possible Bug (or misunderstanding)

NodeCanvas Forums Support Possible Bug (or misunderstanding)

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #10221

    Ok say we have the following setup: a FSM with 2 state nodes called MAIN and NEST, MAIN transitions to NEST and NEST transitions to MAIN. MAIN has the action to print ‘Start’; NEST is a nested FSM with one state also called NEST that has the action to print ‘Nested’.
    How I understand it is that when the FSM starts the MAIN state is entered, it prints ‘Start’ then it transitions to the NEST state, which is the nested FSM, as it enters the NEST state in that FSM the ‘Nested’ log print action would be fired.
    OK so everything works so far and its all logical now: when the NEST state in the nested FSM is done the OnFinish event fires and it transitions out of the nested FSM NEST to the MAIN state. This does NOT happen. Is this a bug or am I misunderstanding something?
    I’ve attached a sample unity scene.

    Another thing: if I try and create a ‘local blackboard’ for a nested FSM that is attached to the main FSM, like in the attached example, the blackboard reference to the ‘local blackboard’ attached to nested FSM is replaced by the main blackboard when switching between the FSMs using the NodeCanvas editor window.

    #10228
    Gavalakis
    Keymaster

    Hello,

    Until a couple of versions before, an FSM was considered Finished when it has reached a Finished state with no outgoing connections, like in your case. Some people said it was a bit unvonenient to end an FSM automaticaly in such a way and thus I changed it.
    So what happens now, it’s that even though the nested FSM’s single state is Finished, the nested FSM as whole is not finished, hense the “clock” icon on the node in the MAIN FSM nested node.
    I agree that it’s more logical for a nested FSM to be Finished in that case though.
    I will take a look at doing this again in case an FSM is nested, possibly by an option on the Nested FSM State Node.

    Regarding the local blackboard. NC doesn’t work this way. All Nested Systems (BTs, FSMs) use a single blackboard that is passed to them from the root/main system. That is also why it is changed in editor time to reflect that.
    That way a nested FSM or BT is more flexible as it can be “parametrized”.
    For example say you are using the same nested FSM that makes use of a “target” variable, in 2 or more completely different agents. The “target” can be set to completely different value depending on the agent rather than the FSM explicitely.

    I’ve made the reference fields on the FSM inspector super transparent to denote that they are just references. I think I will have to remove those 2 reference field completely to remove any confusion.

    Thanks

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

    #10227

    Ok cool thanks for the reply, I understand a bit better now.

    Having an option on the Nested FSM node to allow it to reach Finished state would be great, flexibility for everyone. 😀

    #10226

    You could also just add an action that will transition back to the parent FSM, I think that would be the easiest to implement maybe at the moment.

    #10225
    Gavalakis
    Keymaster

    Yep, I will look into allowing FSM to reach Finish state under these circumstances.
    Right now you can certainly transition from the NestedFSM back to the root based on some condition of course. For example the nested FSM could send an event that the parent node would Check (SendEvent, CheckEvent)
    I know that’s not really convenient, but it’s the only option now, until I make the FSM finish 🙂

    Cheers!

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

    #10224

    Ok cool I’ve updated the sample I was working with using Send Event and Check Event but still no joy. I take it I did something wrong…
    I’ve made the Send Event Global, still nothing.

    Attached it updated test scene.

    #10223

    Ok it seem all I had to do is put a small delay in the Send Event action (0.1) and its working now.

    Thanks.

    #10222
    Gavalakis
    Keymaster

    Yep, sorry there is a mini bug when sending an event before actually checking it. By introducing that slight delay, the check executes first and thus there is no problem. It’s in the TOFIX list.
    Thanks.

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

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