Hi, I’m trying to design a NPC patrolling behavior in FSM.
For the illustration purpose, I simplified the example.
1. The NPC will be either Idle or Patroll State.
2. While in either state, and when the NPC is attacked, it will play “Damage” animation and go back to the state right before the damage.
I use “Any State” to listen for Damage event so that it can capture the event regardless of the state the NPC is in.
The way I understand “Any State” is that it’s global state listener/handler and it’s probably the good usecase for my setup.
However, here is the question.
When “Any State” finishes playing “Damage” animation, I need to continue what it was doing before, that is, I need go back to the state(Idle or Patrol) it was in previously. Is it possible?
It seems like “Damage” state will force other state to quit prematually.
Basically, I would like to just pause the state when interrupted by “Any State” and go back to it later on.
Is it possible to add options to…
1. pause the other state. (other state means “Idle” or “Patrol” state)
2. finish the other state but remember the state and just restart at that state.
3. force stop the other state (this is the current option right now)
4. run both “Any State” and the other state simultaneously.
If possible, I will add quite a bit of flexibility to the system.
Thank you very much.
-chris
ps. If you really want the flexible system, “Any State” should also be part of “Action State” because depends on the state, there could be different listener/handler, especially when your FSM becomes complicated you may want to take the current state your are in into account when handling “Any State” I’ve dealt with many such cases with FSM before and I hope it makes sense.. (I can explain more if it needs clarification)
Thanks a lot for the feedback.
I understand what you describe here, but at least right now, it’s not possible to be achieved. “Any State” has really been modeled to create interuptions from Any state to some other State.
I will certainly look further into improving the FSM system in the future, but may I suggest you to use behaviour trees if such immediate “behaviour changes” are what you are after?
Regardless, can you please describe and elaborate further on what you mean by your PS? ( “Any State be part of Action State” ).
Again, I will certainly look further into improvements, and thanks a lot for your suggestions. I really get the point of what you are after here. 🙂
Hi, Gavalakis,
Thanks for your positive feedback. It makes me I want to contribute to NC more and more. ^^
What I mean by PS is this.
I would like to extend FSM state by attaching properties, kind of like “decorator” concept in Behavior Tree.
In this way, for example, when “Any State”(you probably need to change the name) is attached to a “Action State”, it becomes the hanldler to the attached “Action State” and its “Nested Nodes” only.
(If “Any State” is not attached to any state, then, it will function as is right now.)
This way, it will give quite a bit of flexiblity to design FSM and it opens up for many other possiblities.
Attached node is kind of like a interceptor and it needs to have control options I mentioned in the previous message (it can interrupt the state it is attached, pause, go back to previous.. and so on).
On other words, attached node will get first chance to get executed, and then, the state it is attached to will get a chance to get executed next.
And depends on the option attached node has, the attahced state will pause, stop, simulteniously execute when attached node is executing.
“Any State” is just one example of the usecase and we can come up with many other type of attachable nodes in the future.
Hope it makes sense. ^^
Cheers!
-chris
Author
Posts
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.