Nested FSM never runs onFinish if has AnyState node

NodeCanvas Forums Support Nested FSM never runs onFinish if has AnyState node

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #11702
    timoxley
    Participant

    If a nested FSM contains an AnyState node, an onFinish transition in the parent FSM will never fire.

    The FSM should probably also behave as if there’s no AnyState node, if there’s no possibility of the AnyState ever triggering anything, e.g.
    * There are no transitions connected to the AnyState node. (simple to detect)
    * The AnyState node is set to no retrigger and it’s trying to transition to the same node.
    * The AnyState node is set to no retrigger and the only node it’s connected to has no transitions. (i.e. FSM should finish when the connected node finishes)

    IMO, AnyState should be functionally equivalent to attaching the same transition(s) to every state by hand.

    i.e. if within a nested FSM Node, A, B and C are ActionNodes connected with some arbitrary transitions, then:

    Should be equivalent to:

    However currently the behaviour of these two configurations differs in that only the former will not execute onFinish for the entire FSM Node when C is finished.

    I suggest there should be some built-in Action that explicitly finishes the current FSM.

    #11703
    timoxley
    Participant

    if you’re listening for events in your transitions, one solution to this is doubly-nesting the FSM i.e. Wrap your Nested FSM within another FSM and have any event transitions you’d connect to the AnyState connected to the wrapper FSM instead.

    This is made mildly irritating though since the nested wrappers will need to be file assets, rather than bound graphs. Blegh.

    #11711
    Gavalakis
    Keymaster

    Hello,

    The condition under which an FSM is considered finished has changed a lot of times in the past since different people expect different things 🙂
    I understand what you say though and it mostly makes sense, but because of the many times this behaviour has changed already, I will have to think twice before changing it once again, as so to avoid the unfortunate possibility of breaking existing setups. I will though add a check to see if AnyState has any transitions (your #1 condition), but I don’t see why you would want to have an AnyState without any transitions 🙂

    Having said that, here is an action task (that will also be included in the next version) which force finish the current graph whatever it’s type is (BT, FSM, DT).
    The action also has a parameter to finish the graph is Success or Failure since some Nested Node types are making use of this.

    Please let me know if that works for you.
    Thanks!

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

    #11762
    pierrickb
    Participant

    Hi,

    I’m wondering how this was supposed to work after the update.
    We had several sub-fsm with AnyState nodes, all of them broke following the update because none of them could be exited. With the current setup I have the impression that a sub-fsm with an AnyState simply can’t finish, am I right ?

    #11764
    Gavalakis
    Keymaster

    Hello,

    That is (probably unfortunately) correct. An FSM with an AnyState will never finish. You can of course always use a transitional condition to exit the sub-FSM. If this impose a problem for you, I think I could add an option for whether or not an FSM can be “Auto-Finished”, since it seems that different people need different options for their setup in this regard. 🙂

    Let me know.
    Thanks

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

    #11800
    pierrickb
    Participant

    Hi,

    I did not find any “transitional condition” to exit the FSM, except the one you posted above. Maybe I missed them …

    It may be a good idea to add an option, yes, as we are mainly use “Any State” to look for button clicks at a given moment in our game (placement phase in a tactical RPG, for example).

    For now I added your custom action and it’s working perfectly though, so no pressure.

    #11805
    Gavalakis
    Keymaster

    Hey,
    By “transitional condition”, I mean that you can use conditions on the transitions of the SubFSM-Node in the parent FSM and as such, if a condition becomes true, the transition will take place and thus force stop the SubFSM regardless of which state it currently is.
    TransitionalCondition
    (But I suppose you already know that 🙂 )

    Even so, indeed an option for that would be a nice addition.
    Thanks!

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

    Attachments:
    You must be logged in to view attached files.
    #12267
    quanticdaemon
    Participant

    IMO, AnyState should be functionally equivalent to attaching the same transition(s) to every state by hand.

    I agree, this is the technically correct interpretation of an “any” state 🙂 Are you still planning to implement it this way?

    QD

    #12282
    Gavalakis
    Keymaster

    Hello,
    It pretty much works this way already. 🙂
    What specific implementation, or detail/suggestion from this thread are you referring at? 🙂

    Thanks.

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

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