-
Notifications
You must be signed in to change notification settings - Fork 18
Introduction
The Logic Node Add-On adds a large variety of logic nodes to the UPBGE build of Blender. With these nodes, you will be able to assemble your game logic visually, just like in the Unreal Engine or Armory3D.
Basically, there's two ways to get logic into the Game.
- Logic Bricks
- Python scripts
Using logic nodes is effectively scripting in python, only visually. They have the advantage of being a lot more versatile than logic bricks. Nodes can be placed freely, trees can be nested and eventually, the code contained by each node will be accessible.
This is because they are using Blenders native C++ API, which makes them simply creepy fast. Second fastest is custom python code, logic nodes are the slowest.
You always want to avoid the On Update node, which basically executes something every frame. Only use this when it's necessary, otherwise try to get some kind of condition. Logic trees can also be linked to every sensor the logic bricks can offer, make good use of that.
Each logic node houses some lines of python code. That code is executed when the condition for the node is met. If a node has no condition, it is executed each time the sensor logic brick connected to it is active.
When pressing "Update Code" in the logic node tree editor, a .py file is generated. The file defines a reference class for each node in a particular order so that every node is executed only when all values needed for it are computed.
Then, whenever the connected sensor is active, the evaluate() function for each node is called.
This is where the magic happens. The evaluate() function collects all the input values from its sockets before waltzing though the lines of code that make something happen in-game.
Documentation for Logic Nodes version 0.9.1 on UPBGE 0.3.0 Alpha