playMaker

Author Topic: A "Local Global" FSM Variable  (Read 5546 times)

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • View Profile
    • Disastercake
A "Local Global" FSM Variable
« on: June 07, 2012, 06: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.
« Last Edit: June 07, 2012, 06:30:42 PM by Disastercake »
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #1 on: June 08, 2012, 03: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

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #2 on: June 08, 2012, 05: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 . 
Best,
Sven

MkAndersson

  • Guest
Re: A "Local Global" FSM Variable
« Reply #3 on: June 11, 2012, 02:59:14 AM »
This is a great idea. I hope we get a public version as well for both events and variables.

yezzer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Follow me on Twitter
Re: A "Local Global" FSM Variable
« Reply #4 on: July 01, 2012, 03:45:31 AM »
I'm in the same situation as Disastercake. Is anything like this planned?



Freelance games & App developer using Unity3D, Flash & Adobe AIR for web, iOS, & Android. Interested in AR & other emerging tech.
@yezzer

David

  • Playmaker Newbie
  • *
  • Posts: 18
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #5 on: December 18, 2012, 11:06:35 AM »
Same here... just discovered that "global variables" are really "global", I thought they were just shared between the FSMs of a single object.
« Last Edit: December 19, 2012, 12:12:23 AM by David »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3207
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: A "Local Global" FSM Variable
« Reply #6 on: December 18, 2012, 11:21:37 PM »
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...

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #7 on: December 20, 2012, 01: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

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3207
  • Official Playmaker Support
    • View Profile
    • LinkedIn
Re: A "Local Global" FSM Variable
« Reply #8 on: December 22, 2012, 10:03:04 PM »
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 :)

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #9 on: December 23, 2012, 06: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

robosaru

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #10 on: November 03, 2015, 09: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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: A "Local Global" FSM Variable
« Reply #11 on: January 21, 2016, 08: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