Search Unity

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

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

  1. cel

    cel

    Joined:
    Feb 15, 2011
    Posts:
    46
    Hi Alex,

    As a new user of unity I find your work brilliant, I've been playing with playmaker, but I still don't grasp its full potentiality which I'm sure is huge, I have a few requests for playmaker before you put in the assets store, could we have an evaluation version (watermark or whatever you see fit)? Also a few tutorials (pdf or videos...) on how to achieve simple things, for example how to move a cube with your arrow keys, how to add a cube realtime... and so on? Something like a step by step thing, for those of us who are bit "slow" :)
    Your samples are quite good, but it takes another level of abstraction to quickly understand it in the beggining...

    Thanks for your time and keep up the excellent work
     
  2. Jiong

    Jiong

    Joined:
    Dec 16, 2009
    Posts:
    22
    Open beta version can download from http://hutonggames.com/playmaker.html
    it has full feature. and few tutorials.
     
  3. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    @alexchouls: Some very fast updates you've got! We appreciate it alot! It helps us to stay on schedule! Going to test the RayCast and BroadCastEvent.
     
  4. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    Trying to understand FSM from the sample scenes.. this warning pops in the AddForceToMouseOverObject sample when hit the TestRoom. I just want to know if it's harmless and if could be eliminated. Also, no matter what TAG you assign..
     
  5. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @elvis75k - the warning is harmless, but useful. I didn't have the warning when I made that test scene - but now it's telling me I'm trying to add force to the room! You can fix it by setting the room's Layer to Ignore Raycast. I'll probably add a debug preference to turn these warnings on/off.

    Tags are not used in raycasts/mouse picks. But you could look at the Tag after you've picked an object and decide what to do based on it (using TagSwitch, or HasTag).

    @Frido - thanks for testing! Let me know if there's anything that would make any action easier to understand or use... I try to include useful features in an action so they're not just wrapped Unity commands (e.g., Raycast has a repeat interval and debug view).

    @cel - I'm working on more screencasts, and also simpler examples. A lot of the examples do more than one thing. I need a set of samples that show one thing in isolation, then build up to putting them together... but I think videos will help the most.
     
  6. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    @alexchouls: The more I work with playMaker the more I learn the 'logic' behind it.

    Do you have any tips on how to Smooth follow an object? The Transform Action causes a jittery movement.
     
  7. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    I've found... MoveTowards in combination with SmoothLookAt works well.
     
  8. Ayzhong

    Ayzhong

    Joined:
    Jul 21, 2010
    Posts:
    18
    Hmm is there any way to test variables like float variables, and then send events based on the variables? For example, if I'm trying to make player controls for a space ship, I would use the GetAxes action and store the result in a float variable. But how to I send an event to another state that actually makes the space ship move?
     
  9. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    I was wondering about making custom events with parameters, that actions could respond to. As far as I can see, there isn't a way to do this (as the actions rely on overriding set class methods to respond to events). Being able to define events with parameters, that actions can react to, would be ideal.
     
    Last edited: Feb 15, 2011
  10. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    Thanks for the quick guide to set up the timer, i've followed what you said and realized i need to somehow send the value to a GUIText so i converted the float to a string and then told it to display the strings value with Set GUI Text which should send a timer to the GUIText but all that happens is that the timer counts to 0.02 and then stops, which tells me it's not updated every frame yet i've told it to.

    Sorry for being an annoyance but do you have any more advice?
     
    Last edited: Feb 15, 2011
  11. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    You could use the GetAxisVector Action, store the Vector in a Vector3 variable (eg movement). Then get a Translate Action and use for Vector the Vector3 variable (movement) and set the Space to World. Set the Per Second on.

    Put all this in one State.
     
    Last edited: Feb 15, 2011
  12. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    Take a look at the Logic Actions. You can use Float Compare to send events based on the value of a variable.

    Right now you can't send data with an event. But within an FSM you don't need to - any state can see the variable. And you can get/set variables directly on other FSMs using the Get/Set State Machine Actions.

    The first thing you need to do with an fsm is determine the discrete states you need. In your space ship example, you may only need one state: ControlSpaceShip: GetAxis + AddForce actions. Remember states aren't functions that you call, they're more like a mode that the object is in... and events trigger transitions to different modes.

    So if you decide that colliding with an object temporarily disables the controls, you can add a Disabled state: Play Sound (power down sound fx) + Create Object (particle effects) + Wait. Now you can return to the ControlSpaceShip state on FINISHED. Or to a PowerUp state and then back to ControlSpaceShip...

    Or you add a fire button. You can get the button event in ControlSpaceShip state and send an event to transition to a FireBullet state. FireBullet plays a sound effect, spawns an object, gives it a velocity, then returns immediately to ControlSpaceShip - all in the same frame.

    There are lots of ways to break the problem down. I'll work on more examples for the next update...
     
  13. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    I'm interested in this sollution. How could I set this up?
     
  14. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @Voumerus - Do you have something like this:

    $timerString.PNG

    Make sure you're getting the right time info. Sounds like you might be getting deltaTime...
     
  15. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @Frido - sorry, missed your question... SmoothLookAt will work well for smooth rotations. However, I still need a smooth movement action. You could do it "manually" with Vector3 Intepolate with EaseInOut.
     
  16. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    This is what i have so far, the FSM script is attached to the GUIText



    Knowing me with coding i'm probably just overlooking something simple >.<
     
  17. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    Actually Set GUI Text doesn't have an every frame option - so it's only getting set once... I'll add that option. In the meantime you could use GUI Label or GUILayout Label instead.

    EDIT: Oh, and you don't need the Float Add and the Get Time Info - it's one or the other... right now Get Time Info is just over writing the Float Add.

    EDIT: BTW, you can tell if an action is running if it's highlighted green in the state inspector. If it's grayed out it finished...
     
    Last edited: Feb 15, 2011
  18. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    Ok i removed the Float Add and tried both the GUI's you suggested but still no luck and yeah the action colors explained themselves fairly well :)
     
  19. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    Does it look like this:

    $timer3.PNG

    Just tested that here and it works...
     
  20. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    It looks exactly the same as what you've shown, is your FSM script attached to a GUI Text?
     
    Last edited: Feb 16, 2011
  21. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    Nope. But I tried adding it and it still works. GUI Text shouldn't make any difference - GUI/GUILayout commands are a separate system from GUI Text...

    Strange. What do you see on screen? Anything? What do the debug fields show? Is the float variable updating? And the string variable?

    Do you have the Unity 3.2 update?

    From the color scheme in your screenshot it looks like you're using Unity Indie... I wonder if that has something to do with it? I don't have easy access to an indie copy right now...
     
  22. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    It does work :D the numbers weren't being displayed until the timer had run for a little while as they were off screen and ever time i had run the scene i didn't leave it for long enough so couldn't see the numbers >.< sorry for all this pointless nonsense and thanks for all the help you've given me.

    Do you plan to release playMaker as a free or paid for asset when you submit it to the store?
     
  23. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    No problem!

    Paid. We're thinking $100... but we're thinking about a free trial version with a watermark...
     
  24. cmasterenko

    cmasterenko

    Joined:
    Jul 10, 2010
    Posts:
    67
    Is there any support for iOS controls on here yet?
     
  25. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    Cool chances are you've got a sale here, as you guys update a lot and constantly take user requests on board and help out as much as you can :D

    I've got a new problem now, i'm trying to make a sphere spawn a game object and destroy itself when it enters a trigger but i can't seem to specify the trigger that i want this reaction with, i've managed to get the destroying and object spawn to work perfectly fine but the trigger is the issue.
     
  26. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @Voumerus - Great :)

    You should just be able to mark the trigger Collider as IsTrigger and make sure the sphere has a RigidBody component.

    When the sphere enters the trigger, its FSM should get a TRIGGER ENTER event.

    If you need to know more about the trigger you can use Get Trigger Info
    in the new state to decide what to do.

    Alternatively you can use Trigger Event to filter the trigger before the fact.

    Either way should work...
     
  27. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @cmasterenko - There are some basic actions for orientation, acceleration, and shake - didn't announce it in the update because I'm still working on it and there are no samples yet. No touch support yet... still thinking about the best way to expose those. Do you have any ideas for how you'd like to see touch actions work? For starters I was thinking of a TouchGesture action that sends events on Swipes, Pinch, Rotate... with a GetTouchInfo action to get more details... kind of following the collision/trigger event model.
     
  28. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    alexchouls, what is your release date estimate?
    will you have an off-line version of the documentation (pdf maybe)?

    cant wait!!
    keep up the excellent work!
     
  29. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    Just wrote my own DebugVector3 Action! :) Based on the DebugFloat. Pretty easy to program and it works, but it would by nice if ia DebugVector3 was officially supported by playMaker. ;-)
     
  30. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @clandestine - I will submit to the asset store this week.

    I'm looking for a good tool to convert a wiki to pdf. The wiki will always be the most up to date since I can add notes anytime. But it would be nice to have pdf snapshots...

    @Frido - Cool! I'll add DebugVector3. Eventually I'd like to have a section on the wiki for user made actions, and an easy download path into Playmaker...
     
  31. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    i often use http://pdfmyurl.com/ - i think it can be usefull.
     
  32. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you very much, I'm on holyday right now, writing from a Greek island, and I can't wait to get back home :)
     
  33. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    The quickest way to convert anything to pdf is by "printing" it as pdf ;)
     
  34. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    If it isn't alot of trouble, could you add a Transform Action for the Character Controller? I've tried to convert this script (found it in the Unity doc's) but could not get past the many errors.

    The main problem is to get the GetComponent part.
     
  35. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @elvis75k - Thanks! I'll try it out...

    @megmaltese - The wiki has grown rather large, so I'd like something that converts the whole thing automatically... instead of manually one page at a time. Greek island holiday... sounds nice!

    @Frido - Sure. Been meaning to make some CharacterController actions...
     
  36. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    I'm not sure whether of not i'm doing this correctly but this is the setup i have



    On the second state i have the Create Object and Destroy Self actions

    Also the sphere i'm trying this with passes through 2 triggers before reaching the one i'm trying to make it work with, the 2 triggers simply teleport the sphere to a chosen object but because of the the FSM i'm trying it just gets destroyed and new one spawns when touching any trigger
     
    Last edited: Feb 17, 2011
  37. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    TRIGGER ENTER is sent when the owner of the fsm enters ANY trigger. Any ALL CAPS events are sent automatically by the system. Most of the time you shouldn't send them yourself from actions unless you're sure its what you want...

    In your example, you should make a custom event (e.g., hitPlatform) and send that when you collide with the platform.

    Alternatively, in State2 you could use Get Trigger Info, and decide what to do based on the game object hit. For example you could use Tag Switch to do different things based on the Tag of the trigger.

    It depends if you have lots of different trigger tags and want to do different things for each, or if you're only interested in collision with one trigger tag...
     
    Last edited: Feb 17, 2011
  38. Voumerus

    Voumerus

    Guest

    Joined:
    Mar 4, 2010
    Posts:
    107
    Managed to get it working with a custom event, thanks again, chances are i'll bother you once again with the thing i'm moving onto next :p
     
  39. elvis75k

    elvis75k

    Joined:
    Feb 5, 2011
    Posts:
    24
    Wishlist: iTween actions, some AI and GUI samples.
     
  40. RichBosworth

    RichBosworth

    Joined:
    May 26, 2009
    Posts:
    325
    alexchouls, have you ever used OmniGraffle? I've got it for my iPad, and I love the way that you can search for object libraries (for things such as "UML Design" etc).

    Do you think it would be possible to implement something similar for this? I can imagine users uploading Action Libraries to a central database, and then other users could import the ones they require for their project only.
     
  41. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @Voumerus - no problem!

    @elvis75k - I definitely want to do an iTween Actions pack, probably after the 1.0 release as a free update. I agree, more samples needed...

    @RickyBozzy - Sounds very cool - I'll take a look... have been thinking about how to organize an online Actions Library...
     
  42. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    Our level designers would love to access FSM variables within the Inspector in the Editor. A quick way would be to create a conventional Unity script with only variables. PlayMaker could then read the variable via an custom (yet to be made) GetComponent Action that sends the data to the FSM. But even a better way would be that a special SetValue Action (eg. ReadEditorFloatValue Action) of the FSM can be exposed in the Inspector, in de FSM group.
     
    Last edited: Feb 18, 2011
  43. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    I love that idea. I was going to make an FSM control panel at some point to expose select variables and events to designers, but why not just use the Inspector... perfect! I'll probably set it up so you can check a variable in the Variables Manager to expose it in the Inspector...

    But actually the first method you mention is possible now. I thought I posted code earlier in this thread to do that - I'll dig back. If not I'll post some...
     
  44. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    Thanks! Great to hear that! :)

    I searched this thread but could not find any info on that, except for Sending data to the external scripts. What I'm looking for is a way to Read from external scripts. Can you help me with that?
     
  45. MaDDoX

    MaDDoX

    Joined:
    Nov 10, 2009
    Posts:
    764
    Great job Alex, my studio coders reviewered your implementation and loved it, much less cluttered and more "unity-like" than your competitors by far. To be honest the main thing we'd be concerned about in terms of adopting it is the fact that it uses a compiled .dll. Would you consider special licenses (with a differentiated cost, ofc) including the source code? I know that might not be in your plans, just wondering here.

    Keep up the great work, I've actually voted for Unity Technologies to simply license it from you and add it to the next major Unity release :)
     
    Last edited: Feb 18, 2011
  46. biggthree

    biggthree

    Joined:
    Aug 14, 2010
    Posts:
    56
    does this require unity pro license?
     
  47. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    @Frido - Ah, I misunderstood. To read from external scripts would require a custom action... just a thin interface to get/set properties. I'll try to work up an example.

    @MaDDoX - Thanks! We don't have any immediate plans for a source code license. But after the initial release I'll take a look at maybe creating a source code license for the runtime dll (probably not the editor dll).

    @biggthree - It should work fine with the indie license.
     
  48. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    That would be great! I'm still having some trouble figuring out how to do this.
     
  49. Alex-Chouls

    Alex-Chouls

    Joined:
    Mar 24, 2009
    Posts:
    2,661
    Here's a very simple example:

    Your behaviour:

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class MyBehavior : MonoBehaviour
    4. {
    5.     public float testFloat;
    6. }
    A custom action that accesses MyBehavior:

    Code (csharp):
    1. namespace HutongGames.PlayMaker.Actions
    2. {
    3.     [ActionCategory(ActionCategory.ScriptControl)]
    4.     [Tooltip("Shows how to interface with a behavior on a game object")]
    5.     public class MyBehaviorAction : FsmStateAction
    6.     {
    7.         public MyBehavior myBehavior;
    8.         [UIHint(UIHint.Variable)]
    9.         public FsmFloat getTestFloat;
    10.  
    11.         public override void OnUpdate()
    12.         {
    13.             getTestFloat.Value = myBehavior.testFloat;
    14.         }
    15.     }
    16. }
    17.  
    Drag the an object with MyBehavior onto the action.
    Assign a float variable to Get Test Float and turn on Debug.
    Hit play and change testFloat and the fsm variable should update.

    Now other actions can use the variable that you got from MyBehavior...
     
  50. ROCFriesePoort

    ROCFriesePoort

    Joined:
    Mar 27, 2009
    Posts:
    107
    @alexchoulds: Wow! Thanks, it works perfectly!