playMaker

Author Topic: Global States  (Read 3948 times)

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Global States
« on: May 22, 2013, 11:28:25 AM »
Hi,

I think it would be handy to have the ability to mark a complete state in an FSM as a global one.
How I would see this is that when you have made a complex state that could be used in multiple places you could mark it as a global state, and then in other FSM's you could create a new state from a list of the global ones you have created.
This could be used instead of having FSM Events with return parameters, instead it is kind of a remote state (or maybe event a remote set of states).

I hope I have explained this well enough.

My usage for this is that I have in my game 5 different objects that need to be able to spawn a ball and get the spawned ball object back to do other things with. So I am unable to use a completely self contained FSM, and using global variables could get very messy when multiple FSM's fire the spawn event.
But if there were global states then the actions in them would effectivly run localy in each FSM but would ensure that any changes made would be updated in all linked FSM's.

Regards,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Global States
« Reply #1 on: May 23, 2013, 01:17:30 AM »
Hi,

 Funnily enough I had the same though yesterday, for this, sub fsm is the way to go currently.

The problem with creating a global state, is the variables, it can't expect that the variable this state uses are available in the fsm it's going to be used.

Sub fsm is really trying to answer this very problem. Make a one state template doing what you need, and then run that template as a sub fsm in all states you need to.

bye,

 Jean