Jump to content
  • Advertisement
Sign in to follow this  
Red_falcon

Node-based interface: How to start from scratch?

This topic is 3339 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, for a couple of years i had the intention to write own node-based interface like Node Editor in Blender, Hypershade in Maya or MapZone. Now i finally got some spare time for it so the plan is to write in C# and visualize in WPF. But my first problem is, i cannot get my had wrapped around the data structures. I'm not that bad at programming, but this thing gives me headaches. I wrote a little test application to connect nodes between their pins and to check for data type of the connection. But it feels not really right. Base class Node for nodes and base class Pin for pins, also a Connection class exists. It looks all very simple, but if i look at other source code of similiar programs i have no idead why they look so complex and what my mistake is. Should it be done like an interface pattern? I would appreciate some suggestions or links how it's done.

Share this post


Link to post
Share on other sites
Advertisement
Hey Red Falcon!

Speaking from experience, I suggest you look at what others do, but don't worry about their code as much as the idea behind the code. You can infer on the system just from a GUI. It might help you to remember what you know, and look at where this topic becomes abstract.

What do we know about node based setups? Pretty much one thing: Each "node" can represent anything you want. A.I. Developers treat nodes as a section of a graph to navigate and Autodesk products use multiple nodes for multiple purposes. The only special thing about node based constructs is that something connects them all together. You could say you and I are nodes of the GDNet forum. Typically it's pointers to nodes IN a node structure that establish this connection. One of the simplest examples of a node based construct is a Linked List. I assume you know what this is... Pretty basic. [smile]

You can decide how the nodes connect. Linked Lists are bi-linear: They only care about what node comes before or after the currently selected one, if any.
Other setups like in Autodesk products are hierarchical. The nodes are aware of their siblings (Which can also be a bi-linear relationship) and children. Note how I use the word "aware". The more open connections you have for a node, the more maintenance you have to give for the whole system.

Quote:
Base class Node for nodes and base class Pin for pins, also a Connection class exists.


Personally I think going for more than 2 classes on one of these systems is too complicated already.

I can go further if you need me to, but I use C++. Just remember this: Recursive programming is a real plus here. Just make a struct of type A, and toss pointers in there of the same type that represent a certain relationship with an instance of a node.

I hope this helps.
Cheers!
-Zyro

Share this post


Link to post
Share on other sites
Hey,

thanks for your answer, i will reflect on this later this day, cause other work wits for me. But it seems very helpful.

I will use such graph for different things, but since i'm OpenGL programmmer, it will be used to generate GLSL shader. Cause i couldn't find free editor which will give me all options i want and especially not for GLSL 1.40/1.50.

My nodes are only container for pins. Each output pin will hold the value (int, float, matrix, color) it should give to input pins they are connected. Evaluation of the container/pin that changed shouldn't be big hassle cause of the separation, in my opinion. I hope this idea is not too dumb.

Greetings

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!