playMaker

Author Topic: Run FSM output  (Read 10471 times)

thatnzguy

  • Playmaker Newbie
  • *
  • Posts: 43
Run FSM output
« on: July 07, 2015, 11:02:03 PM »
I keep running into the problem of having a Run FSM pass information back to the Host without having to manually setup the Host to receive the information.

What would be great is if there was a second section of Run FSM that you would fill fields with variables that would receive data sent back by the template.

Eg:
Input
Name: [Name]

Output
Length: [Length]

If the template could read the identifiers of the variables passed to it (rather than just the values) then it would be able to manipulate the Host.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Run FSM output
« Reply #1 on: July 08, 2015, 07:27:59 AM »
Yes we've talked about this in the beta forums. Once you start relying on Run FSM it becomes apparent that the feature was included, has tons of potential but never really fleshed out.

I think Alex had planned to look into improving it after 1.8 comes out.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

thatnzguy

  • Playmaker Newbie
  • *
  • Posts: 43
Re: Run FSM output
« Reply #2 on: July 08, 2015, 04:47:46 PM »
Awesome, that'd be fantastic!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Run FSM output
« Reply #3 on: August 11, 2015, 02:06:08 PM »
I just ran into a situation where having Run FSM pass variables back to the host would make things much easier to setup- hope this functionality is included in the future as well  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Run FSM output
« Reply #4 on: August 11, 2015, 02:18:09 PM »
Check out Get Host Info (Ecosystem/Here)

It doesn't automate the returning of variables and stuff, but you can store the host info which makes sending data back to known variables much more streamlined than pushing the info down from the Host when you run the FSM.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Run FSM output
« Reply #5 on: August 12, 2015, 10:25:08 AM »
Will do- thanks Lane! I didn't understand how to use Run FSM until watching your tutorial vid so thanks for that too  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Run FSM output
« Reply #6 on: December 01, 2016, 11:14:10 PM »
Run FSM Output Function is not enough.
The normal situation is okay which is like Normal FSM>Run Template FSM. Template FSM could use SET FSM VARIABLE or even SEND EVENT WITH PROPERTIES to send output to the Host FSM.
But this structure couldn't make it a great system. When it comes like Normal FSM>Run Template FSM1>Run Template FSM2 that dosen't work. I've tested that Running Template's Variables are not accessible by other FSMs and debugged with the Variable editor window. Template FSM2 couldn't send output to Template FSM1 by Set FSM Variables. And the Template FSM1's name "FSM" is like a blank one which couldn't be targeted by Send Event to GameObject FSM and every Template FSM is called "FSM" during runtime.
So the only way is to setup a special Global Event for Template FSM1 to receive the Event from Template FSM2. But when there are a lot of Template FSM1s and other Template FSMs to build a big RUN FSM system, Sending Same Global Event will fail. It takes time and mind to name and arrange Event.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Run FSM output
« Reply #7 on: December 02, 2016, 01:59:44 AM »
Hi,

 For complex needs, I use Get/SetFsmXXX from templates, and I set in the input the name of the fsm, and the name of the variables I want to expose for read write. then within a template, you can access the host.

for nested templates, it's the same really, pass on the host gameobject pointer, and the fsm name with the variable name to set and you are good to go.

It's not ideal, I give you that... :)

Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Run FSM output
« Reply #8 on: December 02, 2016, 10:12:26 AM »
Thanks for your reply, Jean. :)
 Could you share an Example package of the NESTED TEMPLATES? Cause I had spend some time doing tests but didn't make it. AND IT'S IMPORTANT! :)
I think making Templates is necessary to get the game's logic easy to manage, just like C# scripts, many objects share the same script(or FSM Templates) and you don't need to find all of them to upgrade the logic. And Templates could be easily arranged by named folders.
I'm rebuilding my game in a Template way cause it gets bigger, the NESTED TEMPLATES problem is a flaw to me. Hope you could help me out here. :)
« Last Edit: December 02, 2016, 10:14:03 AM by human890209 »

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Run FSM output
« Reply #9 on: December 03, 2016, 08:06:11 PM »
No actions use the ID yet, but in the future it will be used by actions to uniquely reference a sub FSM. E.g., a Get Sub FSM Variables.
I'm not at my computer to check if it made it into the release yet, but there will be a new Get/Set FSM variables action that supports sub FSMs... It will use the new generic FsmVar so it will be a single action instead of one for each variable type...If it's not in the release I'll post it here or in the 1.5.3 update.

Can't find the magic  GET SUB FSM VARIABLES action. I really need it. ;)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Run FSM output
« Reply #10 on: December 09, 2016, 01:46:02 AM »
Hi,

 Ok, I updated the subfsm demo and implemented a nested sub sub fsm to it.

 Please get it from the Ecosystem.



https://twitter.com/JeanAtPlayMaker/status/806772297897906177

The main thing to watch out is that the host info within a nested subfsm will be of no use, so you need to pass the fsm name down the hierarchy so that you can use GetFsmXXX or SetFsmXXX from a sub sub fsm to the host.

Let me know if you have more questions.

Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Run FSM output
« Reply #11 on: December 15, 2016, 05:22:22 AM »
Hi, Jean. I'm using the GetFSMXX and SetFSMXX to input and output for a period of time with limited functions. A sub-sub-sub-sub-sub FSM could only Get and Set Variables from the First Host (by passing down FSM GO and FSM Name), the mid-level FSM's variable is not accessible.

For example 1 Commando has 5 Captains, each Captain has 10 Soldiers.
 It's like Soldiers could only report to the Commando but not his Captain. The Commando is acting like a Messenger marking a blackboard for the Captains to get what their Soldiers are doing.
So the 5 Captains are acting same as Solder. It should be 1 Commando and 55 Soldiers which is much more reasonable. The 1 Commando - 5 Captains - 50 Soldiers Relationship can't be build by RUN FSM. But we know that this structure is effective doing Hard Work like War, which is more efficient.

I think it will be great to find a way passing info between Sub FSMs such as GET/SET SUB FSM VARIABLES or Run FSM Output which doesn't exist for now.

The FSM ID of Run FSM Action is not be used, which I guess is for marking these Virtual Sub FSMs (not by GO and FSM name when Targeting Sub FSMs), and this function is not be completed. Hope you could talk to Alex about this, as it seems he's already completed the function but not released.

I don't know the @function here, sorry. Could someone help me @ Alex?

Quote from: Alex Chouls on February 20, 2013, 12:16:00 PM
I'm not at my computer to check if it made it into the release yet, but there will be a new Get/Set FSM variables action that supports sub FSMs... It will use the new generic FsmVar so it will be a single action instead of one for each variable type...If it's not in the release I'll post it here or in the 1.5.3 update.
« Last Edit: December 15, 2016, 05:31:25 AM by human890209 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Run FSM output
« Reply #12 on: December 19, 2016, 04:46:15 AM »
Hi,

 I see. For this, I would strongly advice using proper hierarchy or GameObjects and come up with a communication protocole with strong convention instead of configuration patterns. This will give you a lot more power and ease of development/debugging than templates.

Bye,

 Jean

human890209

  • Junior Playmaker
  • **
  • Posts: 62
Re: Run FSM output
« Reply #13 on: December 19, 2016, 11:08:46 PM »
Today I've done some work on RPCs and that Event Target Option of Host FSM inspired me which I've never used before. (I only use Target Game object FSM, never use other options even Broadcast All for intel safety.)

AND I FOUND A WAY OUT OF NESTED SUB FSM!!! 8)

I did a 4 level nested Run FSM(Host FSM Run FSM call's template1, which called template2, which called template3). 2 mid-level sub-FSMs(template1&2)and the 1st Host FSM with a global transition called ABC and target another state which Get Event Properties. The last level sub-FSM(template3) send an event of ABC with event properties. Only the 3rd level nested FSM(template2) which is the sender's HOST FSM got the event and properties!!!

So Nested Template Systems could be made by Sending Event to Host FSM with Properties of Output Variables! The nested template system is just like Method() or Class() of C#. Now I see the potential of PlayMaker! :)

At last,  there comes The Time of Template! ;D

-------------------------------------------------------------------------------
15min later
-------------------------------------------------------------------------------

I've checked my template library, this Send Event to Host Event got a FLAW!
Cause ARRAY VARIABLE IS NOT SUPPORTED BY EVENT PROPERTIES!!!
I need to RUN an Array2String Converter Template in every sub-Templates that output Array Variables. And a String2Array Converter Template after the Host FSM's Get Event Properties Actions (not be RUM FSM but only by Paste Template which is not good for Update & Arrangement ).  ::)

Jean, the legend of PlayMaker Array and Hashtable :D, will Event Properties supports Array in 1.8.4?  ;D
« Last Edit: December 20, 2016, 12:08:10 AM by human890209 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Run FSM output
« Reply #14 on: January 17, 2017, 01:44:58 AM »
Hi,

 Hopefully, wanted to make this happen, but apparently there is an issue with selecting Array type in lists, so I submited a but report, hopefully, this will be fixed and then support will be possible.

 Bye,

 Jean