NodeCanvas Forums › General Discussion › [FSM] ConditionNode
Hello,
I have an idea of functionnality to add to nodeCanvas and which, I hope, will help a lot of peoples.
It’s a Node for FSM which have the purpose to group condition test.
The problem I encoutered for the moment is that 4 states can go to 4 others states. That mean 4*4 conditions in the graph.
You can group it by using sub-FSM (what I did) but each state has a particular test which differentiate them (picture 2 and 3).
The idea to note have 16 conditions was to make a state that automaticly finish and test the specific condition in the substate machine but there is some problems :
– If the specifics conditions are false, you retrigger the state you were.
– You change state and in some cases conditions are false to change state.
The new feature (if it’s possible) could pack conditions to a ConditionNode charged to do the others conditions (picture 1). If it”s false, no state transition, if it’s true you go where condition drive you…
This ConditionNode could be at the start or at the end of a SubGraph for more flexibility (like I did with a state in picture2) 🙂
Say me if this feature is implemented in an other way 🙂
Hello and sorry for the late reply!
Thanks for your suggestion, even though I am not sure I totally understand what you mean 🙂
The ConditionNode you mention will anyway require to have transitions for us to tell it where each condition will transition to, correct?
If so, what is the different of this ConditionNode you suggest, versus using for example an empty state with transitions where each transition has a condition (as it happens now) ?
Can you please clarify a bit more of the difference and the features of the ConditionNode you suggest?
I am totally up for new node suggestion. I just need to understand what you mean a bit better 🙂
Thank you!
Join us on Discord: https://discord.gg/97q2Rjh
Hello,
The problem for the moment is that for example conditionA can be true, but not one of condition D or E and at the moment with an empty state you are .. block on this state. And the empty state is not a real state for your character, it does not make sense.
So for the moment if you want to create this, you need to be sure than one of the condition D or E is true in all case… what is not all time the case !
This feature will simplify a lot the states machines, there are many cases where you need to do that. For example when my character transit from the use of an object to the platformer state machine: I first check (in an empty state that Finish() and CheckCondition() On Enter) if it’s grounded or not / if it’s running or not, to not have a frame with a wrong animation for example and directly go to the right state.
I think this feature will replace a very interesting feature in Unity StateMachine (Mecanim) where you can transit from a SubState to an other in specifying the State in the next StateMachine. This will be stronger than in Mecanim because you can test directly in the subStateMachine where to transit at the entry.
We also need of course the same for exiting a subStateMachine. Some time you just wait a subStateMachine to finish and in that subStateMachine condition to finish are not the same depending on in what state you are. If this particular node (ConditionNode) is not connected to a state, it will indicate that if a condition go to this special node so the StateMachine end. For the moment I use the same trick with an emptyState not connected to any other state, but it’s just a trick =/
Sry for my english, I tried my best :p
Hello again,
Thanks for the follow up and for the further explanation.
So, if I understand correctly this time, as soon as the ConditionNode is executed, it checks the conditions and makes a transitions based on which condition is true. If none is yet true, the ConditionNode is on hold until one of the conditions become true.
It is similar to having an empty state, but you are suggesting a different type of node for this, so that it makes more sense than using an empty state and to be used specifically for that “branching” purpose. Is that correct? 🙂
Let me know.
Thanks.
Join us on Discord: https://discord.gg/97q2Rjh
:'( no :'(
The ConditioNode is never hold for ever. This is the new feature : this node doesn’t stay on it if no condition if true.
It’s just a node for aggregate (?) conditions. State check conditions to this node, if true, the node check condition to state (or over ConditionNodes) if conditions on this node are all false : the state which was running still run ! If a condition on the ConditioNode is true : the FSM transit to the state link to the ConditionNode.
If the conditionNode is the last Node in a FSM : the FSM finish.
🙂