GameNodes (script based bge nodal logic) [Release!!]

Hello Everyone :slight_smile:

This is a project I’ve been working on for a little while now, and I finally got something working.

I have a pynodes system that allows you to interact with the bge.
This is different from projects like hive in how it goes about doing that. Instead of integrating a custom node system directly into the bge, my solution uses python scripts as a buffer. Basically, when you create nodes, they generate a bge script. For now I have to manually add the script, but the plan is for it to automatically be assigned.

The end result of this is that I’m not editing the bge in any way. At runtime, the bge is just reading a static .py file, instead of parsing a node tree. This also means I can fully leverage the power of pynodes, instead of having to do my own parsing from scratch.

Update!

Yeah, I’m still here :slight_smile:
So I spend a bunch of time the past couple of days working on gamenodes, and while it’s not ‘done’, I got it to a point where it’s usable.

below you can see the latest video (sorry about the low res, twitch changed their export settings, I’ll have to fix it for future videos)

because my system uses dynamic nodes, I had to figure out something to make. Lucky for me, Renaud already put together a simple mousemove system that really showed off nodal logic, so I just replicated it.

gamenodes doesn’t look quite as polished, but that’s because all the nodes are generated in realtime, node preconfigured. In future updates I’ll try and clean them up a little, as well as post an in-depth tutorial on how to use them.

Anyway, here’s the v0.0.1 release! [ATTACH]326579[/ATTACH]
simply install like any other addon :slight_smile:
inside the zip there is an example blend showing the mouse move, as well as examples of custom logic (found in the copied_nodes folder)

finally, until I post a full tutorial, here is a quick rundown on how to make your own custom nodes.
The system works by looking for meta tags in the comments.
Step 1: make a new .py file with a function def node_name(out):

Inputs: in the function, add the tag #< input_name behind any variable you want an input for
ex: locationX = locX #< locX *this will create an input called locX, and replace the word locX with the correct value

Outputs: in the function, add the tag #> variable_name behind any variable you want an output for
ex: x = mouse.position[0] #> x *this will create an output called x, and link it to the variable called x

Controllers: if you want code to run, you’ll need something to execute it. use the tag #~ function_name to call a function.
ex. if True: Pulse() #~ Pulse *this will create a pulse output, and trigger all connected nodes when Pulse() is called.

Execution: If you add the tag #` somewhere in a function, a pulse input will be created. when a pulse is sent to it, the function will automatically be ran.

Ok, Sorry. if the tutorial is vague, I’ll put something better together in the future. Anyway, have fun!

Update!

I spent some time today working on custom nodes. They aren’t functional yet, but I did make a lot of headway. I figured out how to have dynamic inputs and outputs, as well as how to build file selection into the nodes.
In the video below, when I change the node type from loc to rot, the inputs are actually being deleted and replaced, not just renamed.

Stay tuned for more :slight_smile:

If you want to watch the full livestream, or see future programming streams, you can check out http://www.twitch.tv/cubedparadoxx/profile/

-Older Posts-
This video shows the addon in action.

I’ll also be posting updates here. Feel free to comment below :slight_smile:

That is great.Could you make a system that aligns instanced objects with each other?Then you could adjust the perimenter to make them overlap by various degrees.It work like the array modifier but in the blender game engine.But it would use instanced objects.That could be made for another demonstration.

This looks promising. I love node based things. Keep fleshing it out!

I suppose, this system should be able to do anything that you can do with python scripting. My main goal is to recreate logic bricks with these nodes, but I am definitely excited about the possibility of making custom nodes for other applications, like yoour array node. To give another example, one could take something like mousemove, a fantastic bge script, and build a node for it that allows for much easier access to the variables.

Thanks for the support, I can’t wait to add more :slight_smile:

Yes this would make blenders workflow much easier and better if we are able to operate in the
node work space and would be less clumpier and claustrophobic than the Logic bricks.
One more problem would be layers ? maybe there is a work around ?
Great Work :)!!!

I assume you are talking about states, which aren’t really layers at all. The ‘layer’ system in the logic brick editor is essentially a way to build simple state machines, where you can flip between different sets of bricks depending on what state you are in.
If you know python scripting, you would know that these sorts of state machines are relatively simple to code. As such, it would be possible to come up with a variety of different state machines using custom pynodes. When you free yourself from the constraints of logic bricks, you are only limited by your imagination, and someone’s ability to implement your idea.

I’d like to mention that this also (in theory) applies to the other attempts at logic nodes, be it hive or playnodes.

Update!

I’ve done a little more work, and I now have multiple nodes that can interact with each other. In the test video, I hook up a simple movement system using a keyboard node and a motion node. The system is still pretty buggy, but something usable will come out of it soon, I promise. :slight_smile:

You might say - well, weren’t there multiple nodes in the last video? Yes, but only on the surface. in the first test, all the first node did was provide a static value.
The new additions mean I can pass dynamic variables between nodes, so there is logic generated for both the keyboard node and the motion node.

Anyhow, here is the video.

Can you investigate allowing properties to be used as input values in regular nodes?

Keypress w------and motion(0,own[‘throttle’],0) local

Or even better

Ray true--------and-------property target Ray.hitObject

(Skipping python interpeter)

Yea, that’s a planned feature, it’s basically already implemented, I just have a lot of bug fixing todo before I expand the node base.
I might be doing another stream tonight yet, if you want to discuss this some more.

One feature that I’d like to start working on as soon as I clear up the bugs is custom logic nodes, as it will mean anyone can create nodes with minimal effort, and it will also make my job easier (in the long run.)

You have input ports on each movement node, does this mean we can plug in a changing property?

Yes, that is the plan. I don’t have anything that creates a changing property yet, but if I did, it would update. There will probably be a demo of this whenever I implement it.

Then you Sir, deserve a Medal, and some tasty cookies, and a small dance number in your honor.

Update!

Well, it took a while, but I do believe I have crushed all of the bugs in the addon. In addition, I worked on the movement system a little, as it didn’t work correctly before. Movement’s still not optimal, (multiple actions at the same time conflict), but I’ll work on that later.

Anyway, now that the killer bugs are gone, I can start working on the best feature of the addon - custom nodes!
I haven’t begun yet, but the next update will surely showcase something of the sort.

Video:

Update!

I spent some time today working on custom nodes. They aren’t functional yet, but I did make a lot of headway. I figured out how to have dynamic inputs and outputs, as well as how to build file selection into the nodes.
In the video below, when I change the node type from loc to rot, the inputs are actually being deleted and replaced, not just renamed.

Stay tuned for more :slight_smile:

Update!

Yeah, I’m still here :slight_smile:
So I spend a bunch of time the past couple of days working on gamenodes, and while it’s not ‘done’, I got it to a point where it’s usable.

below you can see the latest video (sorry about the low res, twitch changed their export settings, I’ll have to fix it for future videos)

because my system uses dynamic nodes, I had to figure out something to make. Lucky for me, Renaud already put together a simple mousemove system that really showed off nodal logic, so I just replicated it.

gamenodes doesn’t look quite as polished, but that’s because all the nodes are generated in realtime, node preconfigured. In future updates I’ll try and clean them up a little, as well as post an in-depth tutorial on how to use them.

Anyway, here’s the v0.0.1 release! Gamenodes v.0.0.1.zip (103 KB)
simply install like any other addon :slight_smile:
inside the zip there is an example blend showing the mouse move, as well as examples of custom logic (found in the copied_nodes folder)

finally, until I post a full tutorial, here is a quick rundown on how to make your own custom nodes.
The system works by looking for meta tags in the comments.
Step 1: make a new .py file with a function def node_name(out):

Inputs: in the function, add the tag #< input_name behind any variable you want an input for
ex: locationX = locX #< locX *this will create an input called locX, and replace the word locX with the correct value

Outputs: in the function, add the tag #> variable_name behind any variable you want an output for
ex: x = mouse.position[0] #> x *this will create an output called x, and link it to the variable called x

Controllers: if you want code to run, you’ll need something to execute it. use the tag #~ function_name to call a function.
ex. if True: Pulse() #~ Pulse *this will create a pulse output, and trigger all connected nodes when Pulse() is called.

Execution: If you add the tag #` somewhere in a function, a pulse input will be created. when a pulse is sent to it, the function will automatically be ran.

Ok, Sorry. if the tutorial is vague, I’ll put something better together in the future. Anyway, have fun!