FlowCanvas Forums › Support › Some questions from former Unreal Blueprints user
Hello, I’m helping a friend of mine who wants to make his own game, and recently decided to switch from Unreal to Unity. He wanted to have a visual scripting system similar to Blueprints and after a short period of evaluation we decided to pick up FlowCanvas. We have some questions, answers to them would make the transition period easier 🙂
1. Is there a way to access the blackboard variables of other GameObjects? It’s the most important question at the moment, as we did it a lot in Blueprints, and can’t find any way to do it in FlowCanvas. If it’s not possible, perhaps you can suggest some alternative approach to achieve the same goals.
2. We want to use some custom structs, but we’re unsure what’s the proper way of doing it. For now I ended up with defining structs in C# that have both public fields and public properties, like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
using System.Collections.Generic; namespace test { public struct test_struct { public int a; public int A { get { return a; } set { a = value; } } public List <int> b; public List <int> B { get { return b; } set { b = value; } } public bool c; public bool C { get { return c; } set { c = value; } } } } |
After adding the struct to preferred types it works well – we can both set the default value of a variable, and get/set the values of specific elements later. Is it the proper approach or you suggest something different?
3. Currently the extractor nodes can have up to 5 output values. If I add my own code that defines more classes like those in ExtractorNode.cs, but with more than 5 pins, will I break something? The same applies to constructors with more than 5 inputs. Are there any limitations to the number of input/output pins of a node?
4. Are you planning to add automatic generation of constructor and extractor nodes for custom structs?
5. Are you planning to add the possibility to create custom actions and functions made of FlowCanvas nodes, like it’s now possible with macros?
Thank you in advance for any help you can provide. Possibly I will have more questions later.
Hello,
Thanks for getting FlowCanvas. I hope you enjoy using it 🙂
Let me answer your questions.
1. I have already create such a node that will be included in the next version. I have also attached this node here for you 🙂
Until now this was done by sending value events to the other flowscript, but of course this was a bit convoluted in comparison to the new node.
2. Using custom types, even structs this way is totaly appropriate.
3. There is no limitation here. You can define as many extra similar classes for more ports as you wish 🙂 I just opted to define 5. Probably I will also define more in the next version.
4. Thats a very good suggestion. I will certainly add this in my TODO list.
5. Can you please elaborate a bit on this one. I am not sure I understood :/ Sorry.
If you have any more questions, by all means ask away.
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Thank you for your quick reply. Of course I enjoy it, we tried the free versions of some alternative visual scripting systems, but FlowCanvas is far superior to them 🙂
1. Thanks for making the node available for me, although I’m not sure where it is, I can’t see any attachments to your post.
5. I mean creating new node-based functions, as described here (in Blueprints the terminology is a bit different, there are pure and impure functions instead of functions and actions). I think it would be a good addition to FlowCanvas, as in some cases using a function or action can be more convenient than using a macro. Of course I can write functions in C# and they will get reflected in FlowCanvas, but the purpose of visual scripting is to eliminate the need to write text-based code.
Oops 🙂 I obviously forgot the attachment. How silly of me.
It’s attached now. By the way, you can find the node in the menu under “Variables/Set Blackboard Variable/Set Other Of Type”
Regarding 5, node based actions/functions can be simulated using macros. Can you please share what is that you deem would differenciate a macro that has been set up to return a value for example, versus a node-based function graph?
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
The node works nicely, although it only sets the variables, the ability to get them would also be very helpful 🙂 (I can set the operation type to Add and the input value to 0 to get the variable value as output, but it works only with numeric types. I can’t find a way to get variables of other types.) Also I think these nodes should work with Lists.
As for functions, I think the main difference would be creating “member functions” that work in context of a particular object where they are defined, and can use its blackboard variables directly, and these “member functions” should be callable from other objects. But now when I think of it, I understand that it’s hard to implement such a feature in Unity, where all GameObjects belong to the same class, and you can’t tell in advance what is defined in an object’s FlowScript. And generally it’s not a big deal for me, I guess I can just create macros with all the needed variables connected to them as inputs. I asked this question in the first place because I got used to working with functions in Unreal, where the game objects belong to different classes. So it seems I will have to accept a “paradigm shift” when working in Unity.
Hey,
I have attached here a unitypackage with the variable nodes and some changes made to them. It also includes a “Get Other Of Type” node 🙂
I will see to making the nodes work with Lists as well. It’s mostly a UI thing to make this happen, rather than functionality of the nodes.
Regarding UE functions, I will see what I can best do to create some similar functionality and the ability to call part of the flowscript from outside of it’s owner. I have some ideas in mind, but too early to say something in specific.
If I can help you further, or have any other suggestions, please let me know 🙂
Thanks!
Join us on Discord: https://discord.gg/97q2Rjh
Thanks for your help 🙂
I will post here again when I have more questions.
pawels,
Welcome aboard!! I only purchased a week ago myself, read the manual but haven’t started playing yet.
Curious though if you would mind giving some of your thoughts moving from Blueprints to FlowCanvas? Or was it more Unreal to Unity?
I tried playing around with Blueprints before, but it felt “clunky” to me. Too much going on for it to be the hobby I spend a few hours a week on. C# is also way easier for me to understand & you gotta love the asset store too !!
Rix
Yeah, the Asset Store is way better than Unreal Marketplace – there is more stuff in general, more free stuff and more cheap stuff 🙂
The main reason why my friend decided to switch to Unity (I’m only helping him, so I’m not the decision making factor here; for my own game projects I use Visual C++, SFML and 2D graphics) were problems with terrain graphics – the landscapes in Unreal look pretty, but there are some serious limitations to them – the number of textures you can use is limited, and you can’t change the heightmap and terrain map at runtime. The first impressions of using the Unity editor are very positive – it turned out that creating terrain that suits our needs is much easier.
As for Blueprints vs FlowCanvas – both systems have their pros and cons. As I mentioned earlier, Blueprints are created more in spirit of class-based object-oriented programming – the visual scripts you create are tied to specific classes. This makes it easier to access variables and functions of other objects – for example if you have a variable of type Object Reference (Character), you can access variables and functions specific to Characters simply by dragging out a line from that variable and choosing a node from the context menu. This applies to user-created classes too – for example you can create your own class that is derived from the Character class, with its own variables and functions. And you can do it in Blueprints alone, without writing a single line of code.
In FlowCanvas, due to the way GameObjects in Unity work, the visual scripts are tied (as components) to individual objects or prefabs. It’s a bit different “philosophy of programming” that requires some effort to get used to, but I think we grasped it by now 🙂 Using custom events to communicate between graphs is really helpful. I like the event system in FlowCanvas – it’s simple and easy to understand, while I fail to understand how custom events work in Blueprints (there are things called “Event Dispatchers”, and I have no idea what they do).
Also there are some bugs in Blueprints that cause annoying behavior sometimes – for example if you add or remove an element in a structure definition, it can cause come connections between nodes that use the structure in question to simply disappear. I haven’t noticed anything like that in FlowCanvas so far 🙂
Thanks for sharing your thoughts.
In FlowCanvas you can also drag a reference port into the empty canvas to get a context menu with nodes (methods/properties) specific to that type as well as a list of other nodes that accept that type as an input parameter. 🙂
Let me know if you have any suggestion on improving that, or anything else for that matter. I’s really like to make FlowCanvas as best as it can get.
Thank you.
Join us on Discord: https://discord.gg/97q2Rjh
Perhaps I wasn’t clear enough. I didn’t mean objects in general – I’m aware that you can access methods and properties of a class from the context menu, and I appreciate it. I meant GameObjects – in Unity they all belong to the same class, so references to them are all of the GameObject type, and the context menu you get from such references is always the same. It’s nothing wrong with FlowCanvas, it’s just the way things work in Unity.
Sorry I misunderstood 🙂
By the way, in Unity and in most cases, it’s best if you have references to the Components directly instead of gameobjects, thus if you have a script on a gameobject, it’s best to reference that script/class instead of the gameobject it is attached to. GameObject is really just a placeholder, like a wrapper. At least that’s how I see it. Unless of course I once again misunderstood 🙂
Join us on Discord: https://discord.gg/97q2Rjh