Search Unity

[50% OFF SALE] PlayMaker - Visual Scripting for Unity

Discussion in 'Assets and Asset Store' started by Alex-Chouls, Dec 31, 2010.

  1. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Playmaker FSMs are great for breaking complex behaviors down into manageable parts. You can see what state a behavior is in, what events caused state transitions etc. So it makes runtime behavior much more transparent and easier to debug. It also makes it easier to iterate and add new states without effecting existing states.

    How you use them is really up to you. Most game systems benefit from the extra organization and visual debugging, even if you can code. A lot of coders use Playmaker to control their scripts, so you get the best of both worlds: low level coding + visual debugging.
     
  2. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  3. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Last edited: Apr 27, 2016
  4. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    What's rather funny is the video screenshot is exactly the way people are feeling about the FB/Oculus buyout, haha.
     
  5. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Yeah, I can see both sides... but definitely excited to see what oculus does with that level of investment!
     
  6. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Last edited: Apr 27, 2016
  7. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Check out part 2 of the top down shooter tutorial:

    [video=youtube;3dq7cz9eTKg]https://www.youtube.com/watch?v=3dq7cz9eTKg&list=UUll8FyIFgevUyLfd-jhhskA
     
  8. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Check out part 3 of the top down shooter tutorial:

     
  9. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    A quick reminder that the latest version of Playmaker works with Unity for Playstation Vita :)
     
  10. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  11. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
  12. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  13. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    New Oculus Rift + Mecanim tutorial on the Playmaker YouTube channel:

    [video=youtube_share;xJSMQutHtIQ]http://youtu.be/xJSMQutHtIQ
     
  14. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Alex, I have two procedural animations in Mecanim and a blend node to transition between them. Can I use Playmaker to have the scroll wheel of my mouse control the blend node?

    If so how do I expose it so I can control it with my mouse?

    Maybe even have a target area on my GUI that activates it when my mouse curser is over it..

    Does this make sense?
     
  15. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Hello Licarell,

    Just to clarify, you mean blend tree right?

    Typically, a blend tree is controlled by a single parameter that is then exposed to scripts and PlayMaker ( In the Unity example above, this parameter is called "direction" ). That direction parameter is a float and is controllable viy PlayMaker with the action "Set Animator Float". This action is part of the animator support package you can download here

    Then, within this "Set Animator Float", you can use any mean to control this float, in your case the mouse wheel, which raw input value would be accessed with the action "get axis" with its axis being "Mouse ScrollWheel" ( from the Unity Input Manager ).

    Then you simply add your scroll wheel input to the animator float variable.

    If you have trouble making this all work, contact me on the PlayMaker forum ( make a thread or via pm), I'll do a micro sample to show you exactly this setup.


    Bye,

    Jean
     
  16. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Jean... Dude... you are my hero!!!

    Merci!!!
     
  17. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hi, I just started learning playmaker. I find the logic action in playmaker is quite limited and I have a silly question:
    Suppose I have two float variables A1 and A2 and a bool B, I want to check if (A1 > A2) B to fire an event, what should I do with the actions in playmaker?
     
  18. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,533
    You can use FloatCompare and BoolTest.

    Stacking them in the same state would be fine, but you could separate it into two states (Float compare) ----> (Bool Test) ----> (DoSomething). Just use the events from those actions to exit to the state you want, based on the logic.

    Make sense?
     
  19. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Thanks @LaneFox.

    How to do it in the same state? It looks like with FloatCompare i can't save the result in a bool variable. I understand FloatCompare can trigger event to another state, but that's not what I want. It's a simple task. I could done with just one line of code so that's unbelievable to require multiple states to handle it.
     
  20. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,533
    If it were in the same state you could divert to a fail state from the float compare so the bool test wouldn't even be done, and not fire any event if the float compare passed, which would flow through the bool test next.

    Have you checked these out?

    http://hutonggames.com/playmakerforum/index.php?topic=5198
    http://hutonggames.com/playmakerforum/index.php?topic=5051

    Simple things in code aren't always equally simple in Stock Playmaker (and so vice versa). Given the entire framework of Playmaker is based around state management, some things simply aren't going to be faster/better, especially if you aren't going to take advantage of the event system. You can always make custom actions for anything you couldn't already do with the existing actions like the linked ones above. There are heaps and heaps of custom actions on the forums, its always worthwhile to take a look before you go off track to get around something.
     
  21. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    429
    Typically, it can be done in one state:

    $equation_onestate.png

    Right click on that image and "Open in new tab" or a similar command to view it full size.

    I have set the event target to broadcast all to show that this state can actually broadcast events from it's actions events, without having to resort to a second state with a "send event" action.

    If that's not making sense, I'll compile it as a package and send it over here.


    Also, there is really nothing wrong with multiple states ( both in terms of logic and performances), what you can condense in a one line of script is essentially a pretty print, but can also be spreaded out into several line for clarity. What I showed above is something I never do, because there is too much going on with far to much reach. I usually spread in many states my logic, because then it all become visually obvious, and a lot easier to track at a quick glance what an fsm does and where it's currently at. Even totally synchronous equations most of time are more flexible when spreaded out into several state, refactoring is easier, and readability is improved, making the visual nature of Fsm shine.

    Hopefully, that all made sense :)

    Bye,

    Jean
     
  22. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    I would definitely second what Jean says about using multiple states to clarify the flow of logic. States are generic - a state can be used to represent a high level behavior or a single step in an algorithm (much like a flowchart). Generally you will have more concrete terms than A1, A2 and B, terms that you want to express in the graph view to help you build and debug the logic. For example:

    $LogicFlow.JPG

    Also using multiple states lets you see the flow at runtime in the graph view and in the FSM Log. You can even pause the game and step back through all the state changes and examine variables etc.

    Having said all that, there are times when you want to just type in an expression! We're working on an expression action that will let you do this and hope to release it soon...
     
    Last edited: May 14, 2014
  23. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Hi @Jean and @Alex,
    Thanks very much for the suggestions. I understand the advantage of using states. In my case I just worried about mixing such simple bool logic state to some real "Meaningful" state in one state machine will make graphic hard to read.

    For example in a fighting game I'm going to check if the X axis is greater and 0.1 and the A button is pressed then forward to a punch attack state. axis and button check could be in a combo list and they must be triggered at the same time. It doesn't make any sense to put in different state. And I can barely take the advantage of realtime debugging for those simple action. When I have a large combo list and this goes complex, you can imagine here could be lots of duplicated states on such bool logic things. The just distract my attention on more important states when I see such a large graph.

    So it's great to hear @Alex you have a plan to let us type in an expression. Looking forward to the next update.

    @LaneFox
    Custom actions is a good way, I will look into your reference. Thanks!
     
  24. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    You can also nest FSMs using the Run FSM action: Make an FSM that does only the work you need and expose variables with the Inspector flag. Save this FSM as a template and you can run it at any time using Run FSM. Inspector variables will appear as parameters in the Run FSM action, so you can expose A1, A2, and B as parameters but keep the implementation details hidden inside the template.

    This strategy can help you keep a consistent level of abstraction across states at any level; e.g., top level for overview, drill in for implementation.

    Essentially it lets you make your own actions inside Playmaker.
     
  25. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    7,533
    FSMception
     
  26. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Sheesh I never looked at and/or thought that RunFSM worked that way...templates.

    Damnit Alex!!! :D

    -Steven
     
  27. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,697
    The Dialogue System for Unity v1.2.3 is now on the Asset Store. It includes PlayMaker support that makes it easy to drop interactive branching conversations, barks, and quests into your projects. If you're using an older version, please look over the Release Notes and update your copy. A lot of great new features have been added!
     
    Last edited: May 14, 2014
  28. tr1stan

    tr1stan

    Joined:
    Jan 23, 2009
    Posts:
    150
    Sounds like the best way so far. I will check it out. Thanks @Alex
     
  29. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    :)
     
  30. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Looks great! Love the support for articy:draft too...
     
  31. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Last edited: May 16, 2014
  32. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    A few other case stories using Playmaker:

    Fightback by Ninja Theory, makers of Devil May Cry:
    http://unity3d.com/showcase/case-stories/ninja-theory-fightback

    $fightback1.jpg

    “We've made use of PlayMaker, which has given our designers a lot of freedom to work without needing to rely on code support for every little job”

    The Forest, using Playmaker for the AI:
    https://unity3d.com/showcase/case-stories/the-forest

    $theforest_4.jpg

    M.U.S.E:
    http://unity3d.com/showcase/case-stories/labrats-muse

    $muse_01.jpg

    "PlayMaker for Unity is awesome because it lets us quickly set up in-game events and cinematics using its visual scripting tool, which has taken a large burden off of our programmers’ back."
     
  33. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  34. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
  35. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  36. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Follow The Counting Kingdom by Little Worlds Interactive, made with Playmaker:
    http://littleworldsinteractive.com/

    $CountingKingdom.jpg

    It's an educational game that's actually fun and addictive!! :)
     
  37. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  38. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    In case you missed it, here's the trailer for Dreamfall Chapters, the latest chapter in The Longest Journey series:

    [video=youtube_share;q_SAYD82LMw]http://youtu.be/q_SAYD82LMw

    We're thrilled that Red Thread Games is using Playmaker to help them achieve their vision:
    https://unity3d.com/pt/showcase/case-stories/dreamfall-chapters
     
  39. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
  40. Mikie

    Mikie

    Joined:
    Dec 27, 2011
    Posts:
    367
    Alex, have you looked at Blueprint. Something to strive for. I have just about left good old Unity.
     
  41. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    I'll ask this for myself as a huge Playmaker proponent...

    ...what I saw of Blueprint looks fantastic, so what is it for you that completely pulled you away from Unity? Is it that you wanted the fidelity you feel Unreal offers, and now with BP you can do what you could do here with PM? Or is there something so outrageously superior to BP that it has you all tingly in the nethers? :D

    Cheers!

    -Steven
     
  42. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Yes, I'm playing around with it, and there are definitely some ideas worth stealing ;)

    I like the context awareness; it's something I've been trying to do more of in Playmaker. There's actually a lot more context awareness in Playmaker than people realize, e.g., you can drag a component from a GameObject into a state and select the property to get/set, drag and drop an animation component to popup animation actions, drag a component into the variables tab to make a variable of that type etc.

    However the main Blueprint context menu is very nice... Currently we use the basic Unity context menus, but we've been working on a custom popup window/menu with a search field, so you can type and/or select from a menu. We'll be using this to streamline the workflow a lot, making it quicker to find and edit actions, properties, variables, events etc.

    We also just added a Conditional Expression action similar to the new node in UE4.2:
    http://hutonggames.com/playmakerforum/index.php?topic=7340.0

    But I do have to say that we're also getting feedback from users who find Playmaker easier to use than Blueprint... Blueprint is pretty low level, poking around methods and properties. We have Call Method, and Get/Set Property for low level access, but I think custom Actions generally offer a nicer UI for common tasks.

    We also chose a higher level abstraction for Playmaker, building behaviors around states and events. I think low level visual scripting, with a block for each command that you might normally type is good for simple behaviors (turning lights off and on, opening doors, triggering game events...), but it doesn't help you build and debug more complex behaviors. It's very gratifying how many non-programmers are making complete games in Playmaker, and I think it's partly because it helps you think about behaviors, breaking them down into states and events. Kind of like a flowchart vs an electrical circuit diagram. You can read a flowchart and understand what it does, whereas an electrical diagram can quickly become an indecipherable mess! That's how we approached the design, more top down, than bottom up...

    Anyway, I can't wait to see how all these tools develop! I have a bunch of ideas I want to try out, and the Playmaker community is fantastic, so I think we'll have some fun ;)
     
    Last edited: May 20, 2014
  43. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Check out Heavy Bullets in Steam Early Access and Humble Store:
    http://www.heavybullets.com/

    [video=youtube_share;LXyPREL0Kr0]http://youtu.be/LXyPREL0Kr0

    It looks fantasic and is getting great reviews!
    Made with Playmaker :)
     
  44. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Bug: Can't save a template when the project folder is a subfolder of a folder whose name contains the word "Assets". Believe it or not, I have a folder named Assets Test that I use to test assets in.

    Question: Is there a smarter way to serialize, version and compare PlayMaker FSM's? Why not?
     
  45. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Thanks for the bug report. Would you mind submitting it using our bug report tool so we can track it: Main Menu > PlayMaker > Tools > Submit Bug Report. Thanks!

    PlayMakerFSMs are MonoBehaviours so Unity handles the serialization. Diffing of Unity assets can be difficult. We plan to save a parallel xml description of FSMs purely for human readable diffing. Eventually this could lead to visual diffing in the Playmaker Editor... which would be very cool!

    EDIT: If you have a Pro license you could also change Asset Serialization to Force Text. These text files can still be hard to diff... but maybe better than nothing...

    EDIT: I'm not able to repro the template saving bug. Please open a bug so we can work through the issue and figure out what's wrong... EDIT: Thanks for the bug report.
     
    Last edited: May 21, 2014
  46. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Sound fantastic! Looking forward to it. Just being able to diff in external version control systems such as Git or SVN would be a big help. But a built-in visual diff would blow my mind and I think a game changer for PlayMaker users who aren't accustomed to version control systems.

    Here's how visual diffing Blueprints looks in Unreal: https://de45xmedrsdbp.cloudfront.net/blog/DiffTool-1009x542-719850393.png
     
    Last edited: May 21, 2014
  47. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Thanks for the link! Yeah, we have something very similar planned for Playmaker... :)
     
  48. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Last edited: May 22, 2014
  49. Kellyrayj

    Kellyrayj

    Joined:
    Aug 29, 2011
    Posts:
    936
    Nicely done! Thanks for this.
     
  50. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,663
    Check out Parasol, now on the App Store:
    $Parasol.png
    [video=youtube_share;VGA-KyOqio4]http://youtu.be/VGA-KyOqio4

    I just got to say, Epic is touting a Flappy Birds clone made with Blueprint, while Playmaker users are making cool new games! :) Just check out Heavy Bullets on Steam, I've been playing that game and it's fantastic!
     
    Last edited: May 22, 2014