Search Unity

Assets diamond Visual Scripting

Discussion in 'Works In Progress - Archive' started by maz_dev, Jun 17, 2017.

  1. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    I think you need to extract characters from a string to determine your object position in the grid. For that, I will add new features of the string node.

    For your other need, I will make the upcoming transfer system supporting the most of variable types (including lists).
     
  2. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    To find the edges of the grid, could the information used in the 3d grid generator be useful? as long as this node contains information about the number of elements in each direction and the spacing between them.
     
  3. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    i think the string editing functions are going to be needed. building strings from multiple characters and converted numbers.
    Maybe having a global node, with inputs and outputs and having the current Project Variables rolled up in a drop down list could help. and colour coded so its easier to read this nodes that read/write variables (maybe by variable type like the wiring idea) That would free up the project variable list on the left and also allow for better layouts. Maybe having the input/output links to the node variables moveable would also help. dragging the small gear icon to the other side of the node flips the direction of flow. the arrow direction become more important now.


    i think it may be far simpler if i make the grid from several grid nodes. so i can organise them at the point of creation. maybe top/bottom line. the shorter left and right columns and then another to fill in the center.
     
  4. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    for links I will add a bezier point in the middle of the link, so the link can have 3 points instead of 2 and user can manage it easily throw his graph, another solution can be used, is to let the link be more curved automatically when the input is behind the output.

    About the localization of the objects on your grid, If I understood your need, it's about detecting grid boundaries. I will add in coming versions a new output of the 3d grid generator node, this output is a bounding box like the one for this node: so you will have the parent object of the grid and also the bounding box of the grid

    boundingBox.png
     
  5. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    my actual plan with the grid is to have the grid move underneath the player, and the edge blocks "fall away" (probably using an animated shader) as they move out of the area of view. On the other side the tiles fall up to ground level so the player can walk over them. i wanted to do all this in place, so the player doesnt actually move, but i guess it would be a bit easier to actually move the camera and player together.
     
  6. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Try to use one of these nodes and tell me if it can help:

    detectRay.png

    the first one detects other objects around it within a radius,
    and in the second one, the moving game object detects other game objects in front of its movement, in this one the game object needs to have a Rigid body.

    you can tag the player and do a detector script that you attach to your grid, or inversely attach a detector script to the player and tag the grid objects.
     
  7. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    In the folder

    Assets\Mezanix\Diamond\1_Examples\

    take a look at the example "SwitchMovement", maybe it can help.
     
  8. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    sure, those are ways to do it, but ultimately they arent the most efficient way. raycasts, coliders and rigid bodies are pretty expensive when compared to just doing the maths.
     
  9. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    you are right math is more efficient, but if the ray length is small it may be fine.
    Anyway, tell me if having the bounding box as output for the 3d grid generator node can help you, I can add it tomorrow to the node and send you a package
     
  10. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    i dont think so. the area is easily calculated as the size and spacing is already known. what i`m trying now is having a script on each block and having it control itself. loading its own map data and setting its own shader/colour values and position. at the moment i havent found how to get the game object variable of the game object the script is on. like a "find self" function
     
  11. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    maybe the vec3/put this float in .... could be simplified to a single entry on the list and have a bool on the 3 components (xyz) on the node to show where you want the value to be put, rather than having separate functions on the list for every combination. maybe the same can be done with vec2 and vec4?
     
  12. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    being able to zoom in and and out of the whole view would be useful. its used in many other visual scripting products and people are used to it, also it would allow nodes to be separated more. this was just a quick test at colour coding the nodes (i didn't do all the lines as you can see) an idea i had for the nodes was to have the colours of the input and output nodes bleed over the colours of the node property type, so the user can see how the colours must match. this would help when zoomed out to help see how data flows. Maybe an auto number function can be implemented to number the nodes from left to right, then this can be fine tuned by the user. also copy and paste. the separate project variables node would be useful here. maybe a mini node that attaches directly to the side of the nodes to save space. Is there a way to have an exposed variable available in all graphs. like an exposed project variable. or maybe in just the one graph. an exposed get variable?
     
  13. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi Barada,

    Could you please tell me in which type of node you need this, or in which context, so I can figure out more your need and maybe there is a solution already.
     
  14. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261

    You can zoom out/in all nodes by holding alt + mouse wheel.

    Your idea of blending node color according to input and output is genius, I will test it, technically it can be done by generating the node texture in Diamond runtime (may affect performance), or load a library of textures already authored (more performance friendly), anyway I will work on this idea because is very useful for graph readability.

    I am also working on transfer data between graphs, states, and logics. The exposed variables question can be solved here, once I finish the transfer data system, I will send you a package to have your feedback.

    I robust transfer data system may also be more flexible than project variables system.
     
    Mark_01 likes this.
  15. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    I am enhancing it to zoom in/out centered to the mouse position
     
    Kennth likes this.
  16. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    my plan is to make a prefab tile (cube) and put a diamond script on it that checks to see if it has moved out of the map area (just checks the x and z from the position) if it is it moves itself to the other side of the map. in order to do this the script must know which instance of the object it is attached to.
    so its one of these, but but "get self" or "get the object i am a component of"
     
  17. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Great. AS far as the colour blending across the nodes idea. i had thought maybe if you constructed the ui box with a vertex at the input,output positions then the vertex could have its vertex colour edited appropriately and with the use of a vertex colour shader the points would blend correctly. i can illustrate if that helps
     
    maz_dev likes this.
  18. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    I think you need is to let this game object be known by another script
    the node is drawn by the unity EditorGUI class, I didn't search around yet to know if this class can handle meshs and shaders directly, but another solution could be simpler, this class draw quickly rectangles with images inside, so I can tell it to draw an image on a rectangle near to the input with the input color and a transparency gradient to fake a blending effect with the rest of the node.
     
  19. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    You need this game object to be known by another graph or script, don't you?
     
  20. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    no. just able to find what game object it is on at runtime. it will be on every tile. so there will be 100 instances of it and it needs to be able to find its own instance game object.
     
  21. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    sorry very rough, but can be coded rather than using lots of textures or ram.


    it hasnt come out too well, but i hope you can see how the vertex colour blends. i should have left the water mark off
     
  22. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Ah I understand better now, like the get game object node, you need a node which the output game object is the "the one attached to"
     
  23. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    yes thats it :)
     
  24. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Yeah I see the idea, it is applicable if the Unity gui class draw meshs, i think it can do, but it means reconstruct the mesh at every node option changes because the input output position arn't the same at each node option , this mean integration a triangulation algorithm to diamond, It may be a good idea, but we have to choose an optimal solution between charging the ram, the cpu, or the gpu.
     
  25. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Test this,

    GetBySetNameTheAttachedToObect.png

    the node 0 has output string (the game object name), the node 1 has the game object itself as output.

    All diamond nodes that have a function of type Set ..somthing (in this case "set name") , has as output the object itself.

    It is not the ideal solution but it can work now.

    while waiting for a node specialazed in sending the on attached to gameobject
     
  26. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    https://docs.unity3d.com/ScriptReference/CanvasRenderer.html

    i think theres also a way to add vertices to the canvas mesh.

    its probably far too involved for this. i think there are far simpler ways to highlight the variable types by colour, at least for early development. But thank you so much for the consideration. :)
     
    maz_dev likes this.
  27. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Ahhhh, i forgot about choosing it there. totally my fault. maybe if those options on the input object are shown as a drop down list it would be obvious to dumb user like me that they can be changed :rolleyes:
     
    maz_dev likes this.
  28. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Thanks for suggestions, this way a software evolve,

    many technics can achive the same result, I will took a look at canvas renderer, but as long as it is a class in the UnityEngine namspace not in the unityeditor namespace it may not work in editor plugins, at least if their is an equivament for the editor
     
    Mark_01 likes this.
  29. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Not totally your fault, I have to add this to my Documentation or somewhere in Diamond editor to tell the user that when you set something, the output is the object itself. there is also a dumb developers ;)
     
    Mark_01 likes this.
  30. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    I`m trying to test my map repositioning logic. some debugging tools here would be very useful. i am trying to just change the material assigned to an object and i cant seem to find a way to do it. another way is setting the material colour by object rather than by material.
     
  31. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    You are right I have to make the material accessible in the component renderer node
     
  32. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    but for now test this , it may help,

    setShaderOnMAterial.png
     
    Kennth likes this.
  33. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Curves are now applicable by only one node to transforms position, scale and rotation,

    CtQp9PScHW.gif

    curveOnTransform.png
     
    Barada likes this.
  34. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    The beauty of animating position, rotation, scale and color at the same time.

    mxl2vqNc95.gif

    Image 4.png
     
  35. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Barada likes this.
  36. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    diamond 1.1.3 evolution
    Links Shapes Enhancement
    After the diamond 1.1.2 release, diamond 1.1.3 evolve. Here is the links evolution to enhance graphs readability:

    Image 1.png
     
    Kennth, eggeuk and Barada like this.
  37. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    looking great. With as bit of luck i should get some time to test later or tomorrow. I`ve changed my plans slightly so i can test the animation stuff. i originally was going to have the reveal animation for new tiles as they scroll into view entirely in the shader, but now i think i can simplify the shader and control the tile position and opacity via the material component colour and diamond animated curves.
     
    maz_dev likes this.
  38. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Great, I would like to know if the animation curves and the material accessibility of diamond 1.1.2 are useful for your project.

    I am working now on a data transfer system between graphs and logics for diamond 1.1.3, it may be useful for your projects also.
     
    Mark_01 likes this.
  39. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    As far as the data transfer, the global variables is mostly there in its simplest form. all it needs is access to all the variables and maybe extra information as to where they are being used. this would also extend to a simplified way of moving between different graphs. maybe a "graphs in project" list. which can also be colour coded and have pips on the global variable list variables. Having a named "trigger reciever" event version of the bool node that can be attached to the "do it now" input of a node in the current graph, but fired from another graph using a "trigger transmitter" bool node. this node would need a target graph (or a global setting for all graphs).
     
    eggeuk and maz_dev like this.
  40. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    I see in your comment that you already understand one of the next steps of diamond, the communications between graphs, that is existing now with the project variables and the boolean event system, as you said.
    My ambition is to extend it to more variable types (like you said also) as the first step, and in the next step, give all graphs in the project a visual representation to have an overview of the project.
     
    Last edited: Aug 17, 2017
    eggeuk likes this.
  41. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi I think there might be some bugs in your latest version with the curves added. The example scenes containing curves and colors don't appear to do anything. Also it no longer lets you do a build without errors. Your older example scenes still appear to work in the editor though.

    Thanks,

    Ian
     
  42. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi Ian,

    thank you for noticing it, could you please send me a screen shot of the error or the error text so I can figure out what it is to correct it
     
  43. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    diamond 1.1.3 evolution
    Links colors according to variable types
    After the diamond 1.1.2 release, diamond 1.1.3 evolve. Here is the links color according to variable types to enhance graphs readability :

    Diamond _1_1_3_Documentation_New_Features.png

     
    eggeuk and Barada like this.
  44. eggeuk

    eggeuk

    Joined:
    Sep 1, 2013
    Posts:
    88
     
    maz_dev likes this.
  45. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    @eggeuk thank you so much and happy diamond using for you, thank you also for your valuable comment on the diamond asset store page and for the 5 stars, it's a pleasure to see people notice quickly the concept of our work and appreciate it.
     
    Mark_01 likes this.
  46. eggeuk

    eggeuk

    Joined:
    Sep 1, 2013
    Posts:
    88
    Just in short one question, maybe the answer is easy to find - but ...

    How can I use a 3rd-party tool? Lets say I want to use TextMesh Pro, actualy Diamond has no interface reaching the functionality of that tool. Or am I wrong?
    Other scripting tools are using public variables or public methods offered by the 3rd-Party-tool.
    Or it has to be done some C#-scripting for writing a wrapper/adaptor for reaching the new elements.

    For communicating with 3rd-party-tools there has to be some special functionality. In Diamond talking there should
    be a special "Variable Typ" and/or a " special "Compute Typ".
    What is the diamond way? I realy wood like using TextMesh Pro.

    I found the Logic Typ "Use Extensions", please give some information to me.
    Thanks
     
    maz_dev likes this.
  47. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Use Extension is now under development, it appears in the logic node but for now, there are no extensions.

    I already figured out how to add extensions to diamond. For now, I will add some extensions to experiment this new feature. Once the extensions feature is robust enough we will publish a documentation explaining to other coders how to code new logic nodes for diamond. We plan to make our diamonds extensions and let others doing the same.

    About text mesh pro, as long as it is a popular asset and come with unity 2017, it is possible that we decide to upgrade diamond to unity 2017.x (now diamond is for unity 5.6), and once is done we will try to let diamond support text mesh pro without need for extensions.
     
    Kennth likes this.
  48. eggeuk

    eggeuk

    Joined:
    Sep 1, 2013
    Posts:
    88
    Thanks for your answer! It sounds good if you have figured out the way extension should work.
    Much success for your work.
     
    Mark_01 and maz_dev like this.
  49. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    @eggeuk thanks for encouraging us, we will do our best like always ;)
     
    Mark_01 likes this.
  50. IanStanbridge

    IanStanbridge

    Joined:
    Aug 26, 2013
    Posts:
    334
    Hi just to let you know that I think the build error I was getting was related to another issue. The curve animation example scenes still don't work though. Your examples graphs with curves seem to have them labeled as " do it " rather than "Always do it". If I create a new graph from scratch and set it to the always do it instead the curves appear to work correctly and I can then make a simple scaling with curve and build it.
     
    maz_dev likes this.