playMaker

Author Topic: Group PlayMaker Actions applied to states into Categories or Folders  (Read 13837 times)

joeyjr

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
I would like to be able to group all my PlayMaker Actions that I have assigned to various states into categories or folders that I can name so that I can organize all of them in a meaningful way.  For example I would like to place all my actions that pertain to playing back a movie with sound into a group or folder named "Video Playback" and group all actions related to sound effects and music into something called "Audio", etc. 

I have just found that the more I use PlayMaker, the more complicated and cumbersome it gets to keep track of everything I have applied to dozens of states on many different game objects.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #1 on: August 11, 2011, 06:53:37 AM »
Hi,

 If you are talking about your own custom actions: You can simple inject a string instead of the default set:

Code: [Select]
[ActionCategory("My own category")]

It will then appear in the actions browser amongst the preset categories.

Where you actually place your custom actions in the playmaker/actions/ folder doesn't matter, you can create subfolders at will.

Bye,

 Jean

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #2 on: August 11, 2011, 09:57:15 AM »
yes i was not sure what this post meant either.. But yes i have created all my own categories so i dont have to go looking for them..

Q

Proton

  • Playmaker Newbie
  • *
  • Posts: 17
    • NPlay
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #3 on: August 11, 2011, 04:25:40 PM »
I think he actually means the actions on the states themselves.

I thought I read that 1.2 gives the ability to give an alias to actions on a state. So if you are using an iTween action on a state, you could give it an alias of 'Open Door'. Then when you come back to it later you know right away what that action is doing.

His idea would take it a step further and allow folders to group actions. So you would have a folder on a state called 'Open Door'. Inside there would be an iTween and an Play Audio.

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #4 on: August 11, 2011, 04:43:59 PM »
Hmmm i like that.. Although for the most part my States are already broken up into individual THINGS that they do.. I cant imagine having States that are complicated enough that they are doing that many things.. but maybe i am just using States in a different way or my logic is just simpler.

Q

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #5 on: August 12, 2011, 01:28:14 AM »
Hi,

 Qholmes is right: State is already doing this job of encapsulating a particular task ( be it with several actions). Grouping actions within a state doesn't really make sense I feel. Remember: If you end up with more than 4 or 5 actions on a state, you should really split into several state or find ways around, I am currently building a highly complex and twisted project, and hardly have more than 3 or 4 actions per state. That's the key to remain sain :)

1.2 will bring goodies such state color and action alias, so that will help organizing too.

Bye,

 Jean


joeyjr

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #6 on: August 15, 2011, 11:56:58 AM »
Hi All,

Let me clarify here to remove the confusion.  Proton got it right!  I'm referring to categorizing actions applied to each state.  And it is not always practical to split everything up into multiple states.  For example, lets say that you want to click a button that triggers an animation, plays a video with sound, activates 3 game objects and deactivates 3 game objects.  Currently, just to play a video with sound you have to assign three different actions (play movie texture, set movie audio, play audio).  Triggering the animation is another action and finally each game object that requires activation or deactivation requires it's own action.  Now, since I cannot create and name a folder on my state I'm stuck with 10 actions on my state... all of which cannot currently have custom names.  And this is only one button! I have like 20 buttons to code in a similar fashion.  I'm in the process now of building a complex animated 3D video player with a multi-level table of contents.  All the buttons are 3D buttons (Maya files with animations for button press and release).  The TV screen animates in and out of view.  As I have progressed through this project it has become harder to deal with in terms of trying to remember what all the various actions are for on each button state.... some buttons pause a movie, some play a movie, some play a different movie, some stop all movies from playing or pause all movies from playing and animate a new set of buttons onto the screen, etc. Also, even though for example the action is titled "Play Movie texture" that still doesn't tell me which movie texture is going to be played.  I have to expand the little triangle and then click on the texture button to find out what video is going to play.  Now imagine that you are going to be have a series of buttons all of which will be playing different videos when pressed and pausing different videos when pressed.  PlayMaker starts to get really difficult to manage when you have move then one or two actions assigned to a state.

Specifically, what would be useful to me is to be able to create a folder on a "STATE" and give that folder a custom name such as "Play Intro Video" and then drag and drop all the actions associated with playing that particular video into that folder (play movie texture, set movie audio, play audio).  Then I could create another folder on that same "STATE" that says something like "Pause all other movie textures" and I could then drag and drop all the different Pause Movie actions I have into that folder. The list could go on an on but I think you get the idea now how these folders on states could be really useful and require the use of less states.

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #7 on: August 15, 2011, 02:18:18 PM »
I dont want to be rude, but it sounds like a very bad design from the start.
Even with normal code you dont do this.
You dont seems to reuse anything.
Most you say can be done use to use some global variable so you can keep track of things.
Why need about 20 button that almost do the same things?

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #8 on: August 15, 2011, 02:52:07 PM »
I have run into a similar thing with my project... I forget what some actions do... I go back to a FSM that i have not looked at for a while and it takes me a few min to go through all the actions to mentally break it down.. Maybe a little comment section for each Action would not hurt so that it can be closed up and you can still read what it says. I would support that...

And i seem to remember reading something about nested Actions or something like that. maybe that would address the grouping of common actions into single entries to do specific tasks.

Q

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #9 on: August 15, 2011, 03:11:02 PM »
There's a Comment action you can add to a state that might help.

And of course 1.2 lets you rename action titles to meaningful phrases.

The goal is to eventually have a hierarchical FSM in Playmaker - double click a state and you get a whole new FSM that is only active when that state is active. This will give a lot more flexibility to break up and nest states...




qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #10 on: August 15, 2011, 03:14:46 PM »
Might help...

Sounds cool for the future.

But i still think the comment line even when the action is closed up would be helpful.

Q

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #11 on: August 15, 2011, 03:20:30 PM »
Hi,

 Can't wait for 1.3  Alex :)

 Playmaker reuse of fsm is currently limited indeed. So Yes This is a big issue on large projects because of duplication-->bad maintenance and not  practical.

 Yet, I am dealing with a huge project, and by simply adopting a "plain english" convention for my states and variable, even with 1.1, it's completly manageable. I do use prefabs but it's not nearly as flexible as if we could really reuse/nesting and group fsm actions not be executed on the fly from where ever.

 So, name your states with long names that really express what it's supposed to do, build you fsm as if it was for someone who will not look at the actions, the state name and its transition should suffice to understand the flow and the outcome. Do not settle for any default naming for fsm and states.

 For convenient commenting, I generally create a empty state with an empty string ( use space bar to make each one of them unique), and fill a large comment, then I can position it next to the state in a place that doens't get in the way with the visual flow.

 Scripts are not easier to read out of the blue or in 6 month time when you completely switched to so many other projects.  I actually do think that it's easier to decrypt a fsm than a script. Tho, the worse thing you can do with playmaker is not respecting encapsulation, that is if you start setting variable from an fsm to another without clear strategy and structure. That, in itself will be VERY hard to debug and understand even next week :)

 Bye,

 Jean

joeyjr

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #12 on: August 15, 2011, 04:34:02 PM »
@ Damian,

Bad Design? ? What are you talking about? And by the way there is no need to be rude.   I said that I'm developing an animated 3D video player with a multi-level table of contents.  Each button in the table of contents must play a different video... for example...

Intro
Lesson 1
  • submenu item 1
  • submenu item 2
  • submenu item 3
Lesson 2
  • submenu item 1
  • submenu item 2
  • submenu item 3
etc...

Each submenu item plays a unique video.  If a video "is playing" and you press another submenu item or different Lesson button then the button your pressed needs to stop or pause the currently playing video and then start playing the new one as well as animate the button press animation and sound effect effect.  Each submenu also animates on and off the screen.

If you know of a simpler way of doing this with PlayMaker I am open to any of your suggestions, but simply telling me to use a global variable is far from a solution.
We are all smart individuals here.  You cannot assume that everyone works in the same way that you do.

I like the idea of applying comments to individual actions that you can see when the action is collapsed. That would actually really help me out now.
I'm also open to using more states if that makes sense... basically anything I can do to accurately document, categorize or label the flow of actions I create on each state will be very useful.



Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #13 on: August 15, 2011, 04:47:49 PM »
Like I did say I did not want it to sound rude. thats why i did write it.

What I would do is have global action that will play/pause/stop the video.
On the the buttons on your different nods you you just send info what you want to do to the global action.
Also what video/movie file you want to use.
That way you have all logic in the global event.
You can then easy copy the buttons on every nod you want and you only need to change what file to use.
This will reduce the overhead and you will get a more easy way to deal with the problem.
But that is how I would do it.
 

joeyjr

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
Re: Group PlayMaker Actions applied to states into Categories or Folders
« Reply #14 on: August 15, 2011, 05:03:27 PM »
Damian,

I see your point, but is there a PlayMaker action that can Play/Stop/Pause any video?  The only actions I see in the Actions panel for movie playback/ movie pause, etc. you have to assign a specific video in order for it to work. Same with the audio actions.  I'm also not an expert programmer (which is why I'm using PlayMaker!) so I'm not 100% confident yet with the whole understanding of global variables.  Also, there seems to be only a handful of variable types for use with PlayMaker unless I'm missing something.  For example, if I want to create a variable called "video" and assign its type to "Movie Texture", how is that possible with PlayMaker when the only options for variable type are Float, Int, Bool, GameObject, String, Vector or Color ??  What about all the other variable types that Unity supports such as GUITexture, AudioClip, etc. ??  I understand the difference between a private variable and a public or static variable, but what exactly is the function of a global variable and how can I create one with PlayMaker?