Search Unity

FlowCanvas - Visual Scripting Similar to Unreal Blueprints

Discussion in 'Assets and Asset Store' started by nuverian, Apr 14, 2015.

  1. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    You could probably do it, I just wouldn't want to. Took me 5 minutes to code it, 5 minutes into putting it into a graph only got me this far... and the Switch Integer doesn't look like the right way to go... with coding you don't need to wonder what fits best.

    upload_2016-4-2_19-36-16.png

    Problem is you won't find any visual scripting tool than can simplify such problems, but at least with FC you can probably get there...
     

    Attached Files:

    nuverian likes this.
  2. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    The above foundation won't work, fundamentally flawed. I've just spent an hour trying to figure out nested loops... it's a no go... and if Nuverian posts a solution... please don't... it would potentially put people off with node overkill vs 12 lines of script.

    It just isn't practical to implement complexity like this to visual scripting. If you need to code like that, spend 5 minutes figuring it out via Google. The answers come quick, first page every time. Or ask the community to help via FC forums, programmers like problem solving ;-)

    FC covers 90% of coding requirements so you don't need to learn C#. Create a couple of scripts if you need the complexity, then implementation is easy via reflection.

    Nuverian answers every question & people like me just want more members on board so that the community gets stronger and we all share questions/answers.

    Rix
     
    nuverian likes this.
  3. unitywlp

    unitywlp

    Joined:
    Jan 3, 2014
    Posts:
    146
    Hey thanks for posting loops in fc right using flow canvas with reflections was a best thing.
    and support was also fast
     
    Rixtter likes this.
  4. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    @Rixly239 Thanks a lot for stepping in and helping!
    I appreciate that :) Like you mentioned, some complicated things are best left in code and be called with FC nodes, or custom nodes be created for them instead of breaking evey little structure element with a separate node, even if it can be done so.
    Thanks again.

    @unitywlp Thank you. I am glad you like FC :) If you need anything don't hesitate to ask away.
     
    Last edited: Apr 4, 2016
  5. frekiidoochmanz

    frekiidoochmanz

    Joined:
    Feb 7, 2016
    Posts:
    158
    is it possible to combine this in NodeCanvas WITH Playmaker actions? I want to create a UI manager with Playmaker, and then command it from other objects with NodeCanvas States AND FlowScript functions.

    For example I have a scene object called Menu Manager which manages another game objects PlayMaker.


    That leaves me another question of, how do we communicate variables and even methods from one gameobject holding a nodecanvas element script, with say another totally different GameObject not holding one? or even, also holding one?

    say I want to communicate with a nodecanvas gameobject to a non nodecanvasgameobject script?

    I realize id need a reference to the other gameobject, but how could I access its scripts? (like if it didnt have nodeCanvas)

    now, what if everyone is given nodecanvas/flowcanvas, will all objects be able to communicate or reflect each other in code or action?

    sorry if this has been answered before, just curious. Im attempting to work with UI, its been terrible.
     
  6. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,

    With both NodeCanvas and FlowCanvas there is the ability to get and set variables as well as call methods on scripts added on other gameobjects. In FlowCanvas for example you can get a reference of another object to get/set or call, simply by drag & dropping that other object in the canvas and when this is done a menu will popup for you to select which property to get/set or which method to call.
    Finally, you can certainly combine FlowCanvas with NodeCanvas + the available playmaker tasks altogether.
    If you want to provide a bit more information or an example of what you are after, I could as well provide you with an example in return :)

    Let me know.
    Thanks.
     
  7. frekiidoochmanz

    frekiidoochmanz

    Joined:
    Feb 7, 2016
    Posts:
    158
    I kinda gave up, I was having issues simply accessing the playmaker component on the gameobject which also had the NodeCanvas one, ill definately experioment more. thanks tho.
     
  8. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    What problems did you have? To get access to the playmakerFSM component or any other component in FlowCanvas, you simply need to drag and drop it in the editor canvas and select a method to call or property to get/set.

    DragDrop.gif
    Thanks
     
  9. frekiidoochmanz

    frekiidoochmanz

    Joined:
    Feb 7, 2016
    Posts:
    158
    Oh sorry, I placed a Playmaker Script FSM component, on an object with a Node Canvas Script component BT component, and also a regular script, and a flowscript (as a experiment), however, the variables ive declared inside of PlayMaker do not show up as accessible fields within NodeCanvas, but my script works as normal. I must be doing something wrong. (the script control, Field action, it shows PlaymakerFSM as greyed out? )

    Edit: Im reading the docs on playmaker intergration, do I need to manually drag atleast one node(are they called block?) to the graph and then click sync variables? is thre a way to do it before (trying to add variable reference manually in Add variables like I do to reflect scripts vars when declared public.)
     
  10. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    Playmaker fsm variables are not normal fields nor properties, thus the reason they do not show up to be selected in either NC script control tasks nor, FC drag and drop nodes. Thus it's not possible to use them as "normal" variables.
    I am a bit confused of what you are trying to achieve here though, or the part at which you face the problems :) Sorry. Please let me know what the end goal is and I will try to help as best as I possibly can.
    Thanks.
     
  11. lugard

    lugard

    Joined:
    Nov 27, 2015
    Posts:
    21
    Hello,
    I can set the "integer" value directly, but a "byte" value is imposible to set.
    What can I do to edit the "byte" value directly?
    2016-04-11 16.50.03.png

    And I can not see the property values of the object

    Code (CSharp):
    1. public class State
    2. {
    3.     public bool isLongMemTraining { get; set; }
    4.     public int maxMemTime { get; set; }
    5.     public byte minPauseTime { get; set; }
    6.     public byte chipsQuantity { get; set; }
    7.     public byte area { get; set; }
    8. }
    2016-04-11 17.03.01.png

    It is very difficult to debug an application without easy viewing objects values.
     
  12. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    I have just send you a PM with relevant code changes you can do now to allow both of your requests. As far as inspectable properties though, this is not possible by design. Normal fields of course are though.
    Thanks.
     
  13. lugard

    lugard

    Joined:
    Nov 27, 2015
    Posts:
    21
    On the first point, everything worked as it should. Thanks.
    But the second point is not working, the Object Editor is still empty. 2016-04-14 10.30.12.png
     
  14. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hello,
    I have send you a PM with one more change needed.
    Let me know if these work for you.
    Thanks.
     
  15. lugard

    lugard

    Joined:
    Nov 27, 2015
    Posts:
    21
    Everything works fine, but I have removed the "GUI.enabled = false;" so that you can edit the collection "List <T>" to debug on the fly.
    I get the error: "GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly."
    when running the application if "Object Editors" window is open.
    However, this error does not affect on the performance, the window simply disappears and you have to reopen it again.
     
  16. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    I will take a look at that error and also keep the auto-properties inspectable in the next version. I think it can prove useful.
    Thanks :)
     
  17. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Nested FOR statement that I attempted earlier, now complete:
     

    Attached Files:

    Last edited: Apr 23, 2016
  18. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hey Nuvi!

    I feel like I should be able to figure this out, but I'm unable to duplicate a basic mouselook script with clamping in FlowCanvas. I used your sample above regarding clamping position, but I can't seem to do something similar with rotation. I'm able to rotate the camera rig just fine with Input Axis (mouse X mouse Y) but I can't seem to extract the rotation from the GameObject to then subsequently clamp it's rotation up/down (X axis). EDIT: I have to rotate it to extract the rotation to then clamp it to finally rotate it again...hmmmm.

    I don't necessarily need the full solution as I'd like to learn, but I might need some direction if you don't mind.

    Thanks man!

    -Steven
     
    Last edited: Apr 20, 2016
  19. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Okay I figured it out...

    ...but I'd like to confirm if this looks legit to you. I'm going to attempt to add some smoothing to this, but right now as it is the clamping works perfectly.
    FlowCanvasClampedMouseLook.JPG

    Phew!! Nevertheless thank you for letting me talk to myself here and figure it out on my own lol. :D

    Cheers

    -Steven
     
  20. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Ah I just learned that that you can change the Operation of Set Variable ($RotationX = Value in my graph above) to += to save on a few nodes. I was searching EVERYWHERE for += gah!! :D

    Fun stuff...
     
  21. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Last question for the moment...

    ...I'm not able to duplicate a conventional lastFrame lerp like I do in .js/C#. As you can see, at the end of the graph I set lastRotationX to curRotationX, and then lerp the two in the middle, rinse repeat.

    Any guidance as always will be adored and appreciated :)

    FlowCanvasSmoothMouseLook.JPG
     
  22. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Thanks for posting :)

    Hello Steve.

    It seems you've figured this out before I get the chance to reply :)
    Indeed, the +=, -= etc operation on the Set Variable nodes are not to be forgotten.
    Regarding Lerp in the graph above, it seems that you have set the Lerp T value to 5, when you possibly wanted a 0.5 if taking the middle value is the goal.
    Let me know if that's the case.

    Cheers!
     
  23. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Yea sorry I keep forgetting lerp T is the between A B value...

    ...what I'm aiming at is smoothing essentially, and in my particular graph that is just not happening. So I might have to concede this and ask how you'd do it.

    Don't worry if you don't have time for this, as I already have a very nice script to handle smooth mouse looking. For me this right here is academic, as I do intend to use FlowCanvas for development. I was immediately in love with Unreal's Blueprint's, and as you know from last year how excited I was for your Asset! So yea if you have time I'd love some good old education. :D

    Cheers man

    -Steven
     
  24. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey,
    Of course I have time for supporting! :)
    Smoothing with lerp can be done by using T of Lerp, as Time.deltaTime multiplied by some damping value.
    Here is a graph that smoothly makes the owner move to the "Target" gameobject.

    SmoothMove.png

    Smoothing.gif
    You can of course use the same method for smoothing the rotation like you are after :)
    Let me know if this works for you.

    Cheers!
     
    Rixtter likes this.
  25. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Yea no I can recreate your example easily...

    ...but I'm having the object smoothly rotate from it's last rotation to the current rotation, of which that is dictated by the mouse delta input. You're using a target object, whereas I'm using the object itself and getting and setting it's rotation from frame to frame.

    Again totally appreciating the support but this still has me stumped...

    Thanks Nuvi!

    -Steven
     
  26. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Oh and to be clear of a couple things:

    • I'm fine with using a target object to have my master object 'chase', but only as a learning example do I want to see if my concept is achievable...
    • My gut tells me I'm looking at Lerping the wrong thing, and that maybe it's the mouse input that I need to check against before sending the value to the camera rotation...
    -Steven
     
  27. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Okay I'm an idiot...

    ...I was only updating the graph on Mouse Input!?! I have no idea how I missed that, but yea, I simply aimed the Lerp at the Mouse Delta, did all my fancy tomfoolery and made sure the rotations were constantly being updated every frame (On Update Event) and voila...works like a charm. (Note: In the supplied graph I'm only smoothing out the X output to test. I'll do the same for the Y in the final version)

    Onwards and upwards!! Time to macro the smoothing and the clamping and I should have some nice clean code!

    Thanks for letting me sound-board you for several posts Nuvi!! :D

    Cheers

    -Steven

    MouseSmoothingSolved.JPG
     
  28. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Thanks for this Steve, goes into my Evernote for future :cool:
     
    SteveB likes this.
  29. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    You're very welcome! The more we can all learn the better :D
     
  30. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hey Nuvi, I have a couple of questions and/or requests now that I'm starting to flesh this out.

    • Is there a way to name Macros? Not fond of it simply saying {Macro}, even with tags...
    • Is there a more elegant way than my use of Switch Condition to perhaps output one or the other value based on a boolean? As you can see, I test for Invert, and subsequently branch out to duplicate nodes, which I'd like to avoid. My thinking is a node like Switch Condition, with one In/Out Flow, three inputs for the Condition, Value True and Value False, and with a single output for Value Result. If True, Value True is fired out of the output, and if False, Value False is fired out of the output.
    Btw for those that might ask, the macro's in this latest screenshot is simply a compression of the graphs in subsequent screenshots I've posted throughout the day.

    Thanks!

    -Steven

    FlowCanvasMouseLook.JPG
     
  31. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Okay found it. Just now on a whim I hit <spacebar> and searched for Switch Value, and lo and behold a whole bunch of Switch Value nodes came up.

    Phew!

    Maybe I should go do something else for awhile huh? Lol

    Thanks for reading my ramblings. Hopefully these explorations are useful to others learning this bad boy! :D

    Ciao

    -Steven SwitchFloatBoolean.JPG
     
    Rixtter likes this.
  32. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Oh! Very minor thing for those following along (or scrutinizing my graphs), I mistakenly pulled and added Invert (INT) from the search as that's the only one that comes up. So simply right-click menu to /Functions/Math/Floats/Invert and you're golden. Suffice it to say an Int makes the movement quite stutter-y. :D

    My bad!

    Night all

    -Steven
     
  33. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    This incompetence just won't be tolerated, I call for your head on a stick, lol. Thanks I'll update my saved-for-later graph.

    I think at some point we should move this over to the Flowcanvas forums, it would be handy if we had a section for code snippets etc.

    I've asked Nuv to consider new topic headers for same...
     
    SteveB likes this.
  34. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Haha I almost quit the forum! :D

    You know just to make everyone's life easier, here's the .asset file (I had to .rar it)

    If you post on FC forums can you link us here?

    Thanks RixlyTwoThreeNine!

    -Steven
     

    Attached Files:

    Rixtter likes this.
  35. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey @SteveB
    Glad you got this sorted out. To be honest I also missed that part in your graph!
    So thanks for sharing all these cool images and updates :)
    Regarding your question about macros (which as I see is the only non-answered one now), you can rename macros if you select the asset itself in the project panel and through the normal unity inspector. A quick way to select the asset is to hit "Select Graph" in the flowscript editor while viewing a macro.
    Cheers!

    @Rixly239 Hey, I have now renamed the subforum of custom macros, for examples to be included as well, so that the subforum is now dedicated in sharing of any aspect :)
    Cheers!
     
    Rixtter likes this.
  36. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hmmm might have found a bug...

    ...if I have a node, in my case Set Bool, I set the value to 1 (true). Then I hit Ctrl-D to dupe it, but this is for my False check, so I set this duplicated Set Bool value to 0 (false)...

    ...when I hit Play, this duplicated Set Bool sets the value to 1 (it should never change. Of course I can add a Value variable to enforce 0 but I shouldn't have to)

    Of course if I I add a fresh Set Bool and set it to 0, it's perfectly fine.

    -Steven
     
  37. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey Steve,
    Indeed that is a bug, which is already fixed for the new version comming around soon (along with some new stuff :) )
    Thanks for reporting and sorry about the bug.
    Cheers!
     
  38. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    You tease!!

    Give us a clue... what are we getting? huh? huh? huh?

    :D
     
    SteveB likes this.
  39. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey, sorry :)

    So, here are the changes for the new version coming around:

    • Unity reflected nodes now show the official documentation both in the node browser as well as the node description in the inspector panel.
    • Variables can now be drag & dropped in the graph directly, which will pop an option for get or set.
    • Added CustomObjectDrawers and CustomAttributeDrawers that work very similar to unity's drawers and with which a custom inspector can be implemented for objects or attributes.
    • Improved BBParameters and will now never lose reference to variable renames that was taking place in some cases especially for Global Blackboards.
    • Auto-Properties are now inspectable both in editor panel and in Object Editor.
    • Fixed Object Editor errors when playmode changed.
    • Fixed bug where default values were not being serialized correctly after they change once.
    • Fixed bug where prefab child object references were not references correctly once prefab instantiated in runtime.

    DragDropVariable.gif
    Cheers!
     
    GamerPET, RD and SteveB like this.
  40. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Omg was wondering why I couldn't drag variables onto the canvas...

    ...yay!!! :D
     
  41. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Yip, super job, thanks Gav :cool:
     
  42. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Have you posted it to Unity yet? I'm hitting F5 like a woodpecker :eek:
     
    SteveB likes this.
  43. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Hey, :)
    Yes, it is already submitted. I should be live anytime soon.
    Thanks!
     
    Rixtter and SteveB like this.
  44. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Sheesh you're over here too! I swear I'm not following you around Liking your damn posts! :p
     
    Rixtter likes this.
  45. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    There was a creepy dude hangin around outside my house, raincoat & binoculars, the whole shebang. I rang the cops, best u be on your way... :p

    Yeah if I spent as much time coding than buying & testing assets, I'd have 43 games out there already lol.

    I just can't stomach paying for Nottorus right now, sticking with this puppy ;) It may lack some of the more advanced stuff, but honestly nothing that I have need for as of yet. And I would imagine Nuv will be asking me what it lacks lol, he would be willing to add nodes for any stuff we request.

    Are you nearer to splashing for it yet?
     
    SteveB likes this.
  46. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    No doubt FC (and Nuvi) are rock'in it...def agree :D
     
    nuverian likes this.
  47. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Update is in :D
     
    nuverian likes this.
  48. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    The new version 1.2 in now indeed live. Changes listed here.

    @Rixly239 Thanks for collecting and posting all these nice examples in the forums. Also of course I will ask what's missing and be glad to add it if possible :)

    Cheers!
     
    Rixtter likes this.
  49. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hmmm didn't notice this with the last build, but now whenever I Play my scene, stop and then do anything in the FlowCanvas window, there's about a 6 second delay before something happens. No other part of Unity 'pauses', just FlowCanvas.

    Thoughts?

    -Steven
     
  50. Rixtter

    Rixtter

    Joined:
    Mar 31, 2014
    Posts:
    244
    Yeah I reported this on the FC forums, Nuv replied that it's a caching problem on the helper docs that you can switch off.

    http://flowcanvas.paradoxnotion.com/topic/graph-running-slow/

    Rix
     
    nuverian likes this.