playMaker

Author Topic: Fungus Playmaker Integration  (Read 1196 times)

Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Fungus Playmaker Integration
« on: November 11, 2016, 01:22:26 PM »
New member, don't know if this is the right place to post, though.

I am a fourth year games design student who has decided to create some support for using both Playmaker and Fungus on a single project, and I was wondering if there is anyone here who might be able to give advice on how I might accomplish that. Having spoken to developers on the Fungus side of things, I've determined that the project should be bundled into a .unitypackage so as to not cause people without both programs error messages, and also that there are a few obvious things that would be beneficial such as:

1. A PlayMaker action which can execute a named Fungus block in a Flowchart.
2. A Fungus command which can trigger a PlayMaker state transition in a FSM.
3. A custom Fungus command to copy a Fungus variable value to a PlayMaker variable.
4. A custom PlayMaker action to copy a PlayMaker variable to a Fungus command

I was wondering if there is anyone on this forum that could give me advice on where to begin, what to lookout for, what classes I should look at, or what difficulties I might encounter.

Thanks in advance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #1 on: November 16, 2016, 01:28:44 AM »
Hi,

Your best start is to check how other assets are supported or supporting PlayMaker.

There is long list on he wiki: https://hutonggames.fogbugz.com/default.asp?W714

The difficulties will be the following:

-- you need to know PlayMaker Api and paradigm of working
-- you need to know Fungus Api and paradigm of working
-- you need to know how to script in c#

I have created a trello card for this, please up vote to show interest

https://trello.com/c/mCAUzJdO/172-fungus

 Since Fungus is free, I may allocate some time to this in the near future if there are enough votes.

I would also contact the authors of fungus to see if they are up to support PlayMaker, official support is always better of course.


 Bye,

 Jean


Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fungus Playmaker Integration
« Reply #2 on: November 22, 2016, 04:42:50 AM »
Thank you for the advice that you've given, Jean. The assets wiki will be helpful.

I've gotten in touch with one of the authors and co-founders of Fungus and he's given me the okay to undertake this project, and that I should post on the Github page if I ever need his advice. I was wondering if you had any features or functionality you'd like to see implemented in this project. Do you have any other advice on how to go about this project, such as how to get the two programs to reference each others variables, what steps might be needed to execute a Fungus Block via the flowchart class? Any advice you can give will be really helpful.

Thanks again in advance.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #3 on: November 23, 2016, 11:57:03 PM »
Hi,

 That very much depends on their api, so without diving into it, it's difficult to say.

 likely, you'll need a proxy component which will act as a middle man between PlayMaker and fungus. that's almost a given for a start.

Bye,

 Jean

Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fungus Playmaker Integration
« Reply #4 on: January 14, 2017, 02:39:59 PM »
I've only got the chance to work on this recently, hence why I've not been updating, but I just thought I'd drop a line and give an update. In the passed few days I have managed to create a Playmaker action that can write a string into a string in Fungus, and intend to expand this to accept other variable types. I've also created a Playmaker action that can execute named blocks in a given flowchart.

The trouble I'm having now is accessing states within FSMs with is preventing me from accessing variables or causing state transitions. Th custom actions guide on the community wiki is a bit difficult to parse and I was wondering if anyone had any better tutorials I could use or if they had any experience with Playmaker that they could share.

Jeanfabre, can you elaborate on might a proxy component might be like? I managed to get Playmaker to interact with Fungus directly, but I can't seem to do the reverse. I was thinking of creating a custom script as a middleman, is that what you meant?
« Last Edit: January 14, 2017, 02:46:32 PM by Nilihum »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #5 on: January 15, 2017, 11:09:34 PM »
Hi,

 Are you sure you want to force state transitions? it seems not the right way to go, instead you should have a comprehensive set of custom actions and trigger transitions this way.

 If you have a clear use case, can you explain it and I'll try to come up with the best way to deal with it.

 Bye,

 Jean

Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fungus Playmaker Integration
« Reply #6 on: January 27, 2017, 08:47:43 AM »
I don't have a Use Case, but what I'm trying to do is create a Fungus command that reads in the name of a state and causes the FSM to transition to that state, either by simply forcing it, simply writing the name to the string to transition to into Playmaker so it can handle it from there, or to have the Fungus block be read in as a program. Forcing it this way might be sufficient but the set of custom actions you're suggesting might be more efficient, what's important is that Fungus does the heavy lifting to do the transition . I'm still learning how to expand upon Playmaker like this so I'm currently stuck on how to get Fungus to write variable values to Playmaker variables.

If you've any suggestions on what custom actions and trigger transitions I could create, it would be of great help.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #7 on: February 09, 2017, 12:23:29 AM »
Hi,

 for this, I would strongly recommend you to study the ugui component proxy system which does two things:

-- makes use of public properties dedicacted to create proxies between scripts and PlayMaker hidding away the complexity, so you can visually reference a fsm, an event or an Fsm variable. thats'c for create nice components in the Unity inspector.

-- internally will show you how to access fsm, access fsm variables and set/get them

 Let me know how it goes.

 Bye,

 Jean

Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fungus Playmaker Integration
« Reply #8 on: February 24, 2017, 02:34:59 PM »
Right, I've managed to trigger state transitions using global events from Fungus by using the code found on https://hutonggames.fogbugz.com/default.asp?W329, but I was wonder if you could help just a little bit more.

The lines that get and set a variable don't seem to do anything for me, and I don't know enough about the Playmaker engine to understand what I'm doing wrong; correct me if I'm wrong, but is this what's happening: a FsmFloat variable called floatVariable is created, and then being made equal to a (presumably preexisting) float called "myFloat" is then made equal to 0.5? Is this suppposed to make myFloat equal to floatVariable as when when you send the event? Because I'm trying to write from Fungus to Playmaker and my code doesn't do that. (Edit: I've attached my script if you want to look at it)

I've decided to not use the uGUI proxy for this because I seem to be able to achieve my desired functionality with it and because that it would be one thing more that the user would need to download in order to run the program and I want to keep those at a minimum, despite this I find the uGui quite promising and would like know more of it's capabilities, is there a tutorial or series that can tell me more about it beyond accessing the FSM and writing variables?

Finally, I have the core functionality done for this project, being able to read and write variables between the two engines, execute blocks from Playmaker, and state transitions using global events, but there's not a lot of code at the end of the day. Is there any functionality you can think of that you'd like to see implemented?
« Last Edit: February 24, 2017, 02:46:09 PM by Nilihum »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #9 on: February 27, 2017, 12:37:03 AM »
Hi,

 FsmXXX variable will only work inside a custom Action for PlayMaker, they won't render nor work as is within a regular Monobehavior.

 The way you want to do this is simply not going to work.

in order to progress here, you need to debug properly:

-- first debug whether FunString was found or not.
-- also, OnEnter might be called to soo and the Fsm wasn't yet initialized and so the fsmString is not found.

 Bye,

 Jean
« Last Edit: March 19, 2017, 10:58:52 PM by jeanfabre »

Nilihum

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: Fungus Playmaker Integration
« Reply #10 on: March 19, 2017, 03:28:55 PM »
I'm sorry that I've not been keeping you up to date on this end, I've mostly been searching for help on the Fungus side of things. The solution is done, mostly. It can copy variables back an forth, it can trigger global events in Playmaker form Fungus, and it can execute Fungus blocks from Playmaker.

I've added the unitypackage containing everything and a zip containing just the scripts for you to go over, but I think you can now get the latter from the Github page. If you could go over what I've done and give me some feedback, I'd greatly appreciate it.

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11779
  • Official Playmaker Support
    • View Profile
Re: Fungus Playmaker Integration
« Reply #11 on: March 19, 2017, 11:04:06 PM »
Hi,

Great, twitted about it.

 Bye,

 Jean

tcmeric

  • Sr. Member
  • ****
  • Posts: 320
    • View Profile
Re: Fungus Playmaker Integration
« Reply #12 on: March 20, 2017, 01:18:59 AM »
Been following this because I have been working on many of own actions (not for fungus). Great job to the OP!  8)

Appymes

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Fungus Playmaker Integration
« Reply #13 on: April 27, 2017, 12:54:55 AM »
Hello, it is very interesting to connect Fungus and PlayMaker.

With the package and the scripts, I have been able to activate FSM from Fungus, but I have not managed to communicate the variables from one system to another in any way.

Do you have an example to see how it works? Or can you provide more details?

I would be grateful.

Thank you very much!