playMaker

Author Topic: Multiple FSM per object  (Read 3289 times)

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Multiple FSM per object
« on: July 18, 2011, 06:12:17 PM »
I just realized that i can do multiple FSMs per object... I had just started to get to the point where i needed multiple and was trying to figure out how i was going to manage the work flow... but reading a forum post i realized you just make another FSM...

So are there any limitations? Can they talk to each other at all? Any special multiple FSM actions?

I assume they run totally simultaneously..

Q

giyomu

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 108
    • blog
Re: Multiple FSM per object
« Reply #1 on: July 18, 2011, 10:47:06 PM »
Using more than 1 Fsm per object is actually a good practice as you can't really manage in some condition to handle all in one unique Fsm, consider this as if you put multiple script on an object to handle various things , while they still can communicate together using a "GetComponent" fct.

same goes with Fsm using action for this purpose in StateMachine Tab, like GetFsm somthing or SetFsm somthing, you will just have to reference the Fsm you want target on your object then call event on it or set / get some of the variable you have etc...as you will do code side anyway if needed.

for me multiple Fsm per object has the advantage to keep setup small and clean, when i start to have too much "spaghetti like" branching , I generally check what i can put on his own Fsm just to lighter the reading.

performance wise I don't have any problem with that , it's all depends how often you jump to or update your stuff.   

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Multiple FSM per object
« Reply #2 on: July 19, 2011, 11:31:52 AM »
Cool thanks.. Yes it made total sense to be but i just had not realized that it was possible.. But i was trying to keep my FSMs as simple as possible and some of the things i had read did not make sense until i looked and realized i could make a totally separate FSM to run in parallel.. yea...

Q