playMaker

Author Topic: A graph of inter-FSM events  (Read 26346 times)

seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
A graph of inter-FSM events
« on: April 12, 2016, 09:43:10 AM »

Update:
The PlayMaker communication graph is now shipped as part of RelationsInspector, which is now free and open source.


Original post:
Hello,

I'm developing a graph visulazing tool for Unity and would like to add PlayMaker support to it. In particular, I want it to show how FSMs are connected through events. Currently it looks like this:



The gif shows the PlayMaker window next to the graph window. All scene FSMs are shown as nodes, the events sent between them are shown as edges. When a node is selected, PlayMaker will select that FSM. Edge markers show their event name as tool tip and allow you to open the state that sends the event as well as the transition that receives the event via context menu.

As a PlayMaker novice, I'd be happy about any feedback and critique. I've tested only with the sample scenes and would like to see what the graph of a real project looks like.

If you want to install it, these are the steps:
  • Install the RelationsInspector demo
  • Install the attached package. It's the PlayMaker add-on for RelationsInspector.
  • Open Window -> RelationsInspector
  • Select PlayMakerFsmEventBackend from the window's toolbar dropdown.
  • Click the show active scene button in the toolbar. That will open the graph.
« Last Edit: September 10, 2021, 07:49:30 AM by seldomU »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: A graph of inter-FSM events
« Reply #1 on: April 12, 2016, 12:37:15 PM »
Looks very cool! I'm going to try it out...

MS80

  • Junior Playmaker
  • **
  • Posts: 64
Re: A graph of inter-FSM events
« Reply #2 on: April 12, 2016, 04:39:44 PM »
 :o That looks damn cool and handy!
Something I was missing, a simple way to see how all the FSMs work together!

EDIT: checked it out, really nice start, here is some feedback / questions:
- only "public" events will show up in RI
- does not show events send to "FSM component"
- does not show events send by "send event by name"
- some bugs (f.e. playmakerbackend disappear after switching backends)
- a auto update function would be nice (f.e. update RI every XX frames)
- do you think it would be possible to illustrate shared variables, too (f.e get fsm float, set fsm float)?
- do you plan to sale a RI playmaker version or is RI Pro the only option?
- what about "call method" and "send message"? is it possible to mix backends, it would be handy to see the fsm events and the messages to or from other scripts as well?

btw: RI is great, had a look at the other backends  ;)
« Last Edit: April 12, 2016, 06:44:27 PM by MS80 »

seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
Re: A graph of inter-FSM events
« Reply #3 on: April 13, 2016, 05:51:10 PM »
Thank you for the kind words :)
  • Aren't public events the only ones sent between FSMs?
  • I'll add support for FSM component targets and send event by name actions. Should I add any other actions?
  • The list of backends is filtered. Only the ones that match the target objects of the current graph are shown. Press Clear and all backend types will show up.
  • Auto-refreshing the graph every x frames seems like overkill. The Rebuild button let's you do it manually. Maybe I'll make it a toolbar option.
  • A shared variable graph is possible. Would you want it merged into the event graph or separate?
  • I have no plans for a special PlayMaker version. All PlayMaker support will be in the form of free add-ons.
  • Graphs for called methods and sent messages are possible too. Mixing them is a bit tricky, but I can see how that would be useful.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: A graph of inter-FSM events
« Reply #4 on: April 13, 2016, 07:06:33 PM »
Quote
Auto-refreshing the graph every x frames seems like overkill. The Rebuild button let's you do it manually. Maybe I'll make it a toolbar option.

You could used the EditorWindow OnHierarchyChange event to rebuild the graph... or make that an option. Maybe in EditorWindow OnFocus as well.

I could also expose a delegate in the Playmaker editor when the FSM has been edited, so you could hook into that.

seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
Re: A graph of inter-FSM events
« Reply #5 on: April 14, 2016, 02:34:15 PM »
I could also expose a delegate in the Playmaker editor when the FSM has been edited, so you could hook into that.

That would be great. In the meantime, I'll make it optionally rebuild on scene changes.

I have a problem with SendEventByName: its event name field dropdown contains variables instead of events. Am I doing something wrong? SendEvent actions work fine.
« Last Edit: April 15, 2016, 05:22:26 AM by seldomU »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4005
  • Official Playmaker Support
    • LinkedIn
Re: A graph of inter-FSM events
« Reply #6 on: April 14, 2016, 03:12:27 PM »
Send Event By Name is designed to work with strings. So the dropdown shows string variables. It gives you a little extra flexibility to change the event sent at runtime. It could use a little browse button to set the string value to valid event names, like we do with animation names., but never got round to it. Most of the time you should be using Send Event, so it never became high priority...

Does that make sense?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: A graph of inter-FSM events
« Reply #7 on: April 15, 2016, 01:57:32 AM »
Hi,

 Also, one useful feature would be study and represent where events are fire using the api. I am doing a lot of monobehaviours acting as proxies for firing "system" events. Like for the new UI system. In Many projects, this is playing a important role in the logic flow.

I don't have a solution unfortunatly, other than declaring an attribute to use ( Like I do in PlayMaker Utils), but that means compatibility issues if that attribute is not declared within PlayMaker.


Bye,

 Jean


seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
Re: A graph of inter-FSM events
« Reply #8 on: April 15, 2016, 05:52:25 AM »
Attached is the new version that adds support for SendEventByName actions and FSM Component targets.

@Alex: yes that makes sense. Btw, I can't use the hierarchy-change event for rebuilding the graph. It doesn't fire when FSM actions are modified.

@jeanfabre: I don't understand. Are we talking PlayMaker events or Unity events? There already is an add-on for Unity UI events.

MS80

  • Junior Playmaker
  • **
  • Posts: 64
Re: A graph of inter-FSM events
« Reply #9 on: April 16, 2016, 06:36:31 AM »
Thanks, "send event by name" (also non global ones) and "FSM component" work just fine now!  :)

  • A shared variable graph is possible. Would you want it merged into the event graph or separate?
  • Graphs for called methods and sent messages are possible too. Mixing them is a bit tricky, but I can see how that would be useful.
Great! Visible fsm events, fsm variables and communication to or from scripts would give one a good and quick project overview! I think it would be handy to have those in one backend view, maybe different icons / colors for events, variables and messages (methods)?!

Is visual debugging (like in playmaker FSMs) planned for RI? To see what's going on in runtime would be very helpful!
« Last Edit: April 16, 2016, 06:52:54 AM by MS80 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15594
  • Official Playmaker Support
Re: A graph of inter-FSM events
« Reply #10 on: April 18, 2016, 01:52:50 AM »
Hi,

 I am talking about PlayMaker events yes. I have created multiple systems that allow developers to catch Unity events and forward them as PlayMaker events, and that happens within regular Monobehaviours.

There's a video explaning the basics:



Again, I am not sure it's practical for you to start looking outside PlayMaker, but in this case  (as for all the proxies for PlayMaker you find on the Ecosystem), I created a standardized way of declaring these. It's not 'official' however.


 Bye,

 Jean

seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
Re: A graph of inter-FSM events
« Reply #11 on: April 23, 2016, 11:08:54 AM »
Thanks, "send event by name" (also non global ones) and "FSM component" work just fine now!  :)

Nice! :)

I added relations for variable access between FSMs to the event backend, as you suggested. The new version is attached. Here I wrote basic documentation.



Is visual debugging (like in playmaker FSMs) planned for RI? To see what's going on in runtime would be very helpful!

That's beyond the scope right now, but could be added in a future version, provided that PlayMaker's public API allows it.

@jeanfabre: That seems really useful. Right now I only want to cover PlayMaker's own features though.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: A graph of inter-FSM events
« Reply #12 on: April 23, 2016, 12:06:38 PM »
Wow- the ability to see Playmaker events in the graph like that is really useful- I will be buying your asset-

I'm able to see the variables set if I use "Set Fsm Variable"- they don't show up if I use "Set Fsm Float" o"Set Fsm Game Object"- it would be awesome if variables using those set/get actions showed up as well- unless they already do and there's a trick to it?

Awesome asset anyway  :)
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

seldomU

  • Playmaker Newbie
  • *
  • Posts: 17
Re: A graph of inter-FSM events
« Reply #13 on: April 23, 2016, 01:08:12 PM »
Thank you for the purchase!

I had only considered the Get/Set Fsm Variable actions, I didn't know about the others. I'll add all the Get/Set Fsm ... actions shortly. Are there any others I should include?

rik

  • Full Member
  • ***
  • Posts: 246
Re: A graph of inter-FSM events
« Reply #14 on: April 23, 2016, 01:29:06 PM »
HI
i have just imported the demo version and also the unity package posted here and now i am trying to see playmaker graph but i dont see any option to do that