Playmaker Forum

PlayMaker Feedback => Feature Requests => Topic started by: Disastercake on June 07, 2012, 09:22:46 PM

Title: A "Local Global" FSM Variable
Post by: Disastercake on June 07, 2012, 09:22:46 PM
Currently there are 2 basic privacy settings for FSM variables through the Playmaker GUI maanger: The Global and Local.  However, it would be very useful if It were possible to make a "Local Global" variable, for lack of better naming.  

This means a variable that can be accessed and shared among all FSMs on a single object, but not outside that object.  This could be very useful for storing commonly used information among complex game objects.  Personally, my character units often have 6+ FSMs on them at the moment which all access a custom script I have attached to the game object for commonly used variables like HP, or isGrounded, or isAI, etc.  With the use of "Local Global" variables in Playmaker I would have less need for custom scripts.

Even better would be if you could access these LocalGlobals outside of the object by use of an action that could set or get those variables via specifying the GameObject with an FSM, so other objects could access the variable contents.
Title: Re: A "Local Global" FSM Variable
Post by: jeanfabre on June 08, 2012, 06:23:46 AM
Hi,

 I think the paradign should the same as in scripts.

 a private variable, accessible only within a fsm
 a public variable, accessible from outside fsm
 a global variable, accessible form anywhere.

 I even went further a long time ago and proposed to let a variable be accessible within it's hierarchy.

so if a gameObject with a fsm if it has childs with fsm, them fsm child would have access to private variables, or have another subdivision, private or protected variable.

But, doing all this really goes against a fast learning curve, so this would be difficult to implement without adding a extra thing to learn and confuse beginners.

And it's the same with events really, sometimes, It would really be cleaner to have public events, instead of just global events, that would help encapsulating things better.

Bye,

 Jean
Title: Re: A "Local Global" FSM Variable
Post by: kiriri on June 08, 2012, 08:47:24 AM
Disastercake is very good man :D He's idea very good! Me needs it for character pass down variable to all fsms in hierarchy !

Seriously, I would've asked for this too, sooner or later. I use hundreds(thousand(s)) of get and set fsm variables just so I can manage my characters. Passing down variables through the hierarchy would be incredibly time- and brainpower-saving . 
Title: Re: A "Local Global" FSM Variable
Post by: MkAndersson on June 11, 2012, 05:59:14 AM
This is a great idea. I hope we get a public version as well for both events and variables.
Title: Re: A "Local Global" FSM Variable
Post by: yezzer on July 01, 2012, 06:45:31 AM
I'm in the same situation as Disastercake. Is anything like this planned?



Title: Re: A "Local Global" FSM Variable
Post by: David on December 18, 2012, 01:06:35 PM
Same here... just discovered that "global variables" are really "global", I thought they were just shared between the FSMs of a single object.
Title: Re: A "Local Global" FSM Variable
Post by: Alex Chouls on December 19, 2012, 01:21:37 AM
This is definitely on our radar. I'm not a big fan of having to use a lot of Get/Set FSM Variable actions!

Hierarchical FSMs will improve the situation a lot. Work that would otherwise be split into separate FSMs that have to talk to each other can happen in one FSM with sub states that can all see the FSM variables.

But I want to improve the workflow for other cases too...
Title: Re: A "Local Global" FSM Variable
Post by: qholmes on December 20, 2012, 03:36:06 PM
Funny i just went to make a post on this too...

Private
Public
Global

I just dont like making so many Global variables.. working on my conveyor system and i need my objects to query the variables of the locations they are at to make process decisions. If i have to make all those variables Global it just turns into a huge mess. And my Globals window still takes my scene to a crawl when i Play my scene

Q
Title: Re: A "Local Global" FSM Variable
Post by: Alex Chouls on December 23, 2012, 12:03:04 AM
You shouldn't have to make variables Global to use Get/Set Fsm Variable on them... or maybe I'm not following...?

I agree Global variables should be used sparingly. If I was to do globals again I think I'd implement them differently...  :-\

But Playmaker is still evolving :)
Title: Re: A "Local Global" FSM Variable
Post by: qholmes on December 23, 2012, 08:07:32 AM
Funny you are right... I had an issue and it seemed that i had to when i wrote this and then last night when i was working on my project it just seemed to work so not sure what i was doing before.. Sorry...

Q
Title: Re: A "Local Global" FSM Variable
Post by: robosaru on November 03, 2015, 11:34:46 PM
I would like to bump this. Having a kind of "local global" variable shared by all FSMs on an object, but not global to other object FSMs would be very useful.
Title: Re: A "Local Global" FSM Variable
Post by: jeanfabre on January 21, 2016, 10:12:45 AM
Hi,

 yes, it would be great. It's been discussed many times already. Hopefully one day, we'll have more control over variables exposure.

Bye,

 Jean