1. NodeBox 3
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Download
  4. Documentation
  5. Forum
  6. Blog


NodeBox networks can become really big. After a while, it becomes harder and harder to find the node you’re looking for. To solve this, NodeBox can group related nodes into a network. This works just like on your computer, where you can group related files in a directory on your hard disk.

NodeBox networks can act as an organizational tool, keeping big networks tidy. By grouping a block of nodes into a network, you can box up and name a group of functionality. For example, when working on a data visualisation project, the header and explanatory text could go in a subnetwork “captions”.

NodeBox networks can also act as custom nodes, much in the same way as the built-in nodes.

Root vs. subnetworks

Like directories on your hard drive, NodeBox files are organized as a tree. At the root, or base, of this tree is the root node. Below that are subnetworks. These can nest arbitrarily deep. For example, a network for an animated character could look like this:

Node Invaders

As an example of a custom node we’re going to create the classic “space invaders” character using NodeBox.

Space Invaders Classic Space Invaders

We follow a typical process:

Design the character

The space invader character is a symmetrical grid of 11 x 8 points.

We’re going to create one half of the space invader, then reflect it across the X axis.

One space invader

You can create different variations of the invader by changing the seed value of pick1.

Group into network

We’ve just created one space invader character. To make more of them, we will group the invader nodes into their own network, much like the built-in nodes of NodeBox.

Group into network

You can now choose a name for your subnetwork, type invader.

Publish relevant ports

Note that the invader node doesn’t take any inputs. We can’t change the seed like we did before, for example. Also, we can’t change its position. To make ports available to the upper level, we publish them.

Test the subnetwork

Before we connect any grids or values to the invader, it’s a good idea to check if all published ports do what we expect.

Why do I ask you to test subnetworks first? When creating this example, I published the position port of the grid, thinking that this would work. However, since the invader is mirrored, this gave all kinds of weird effects, which were very hard to debug when looking at a whole grid of them. By testing one invader, in isolation, first we can make sure that the correct input gives us the correct output.

Connect the inputs of the subnetwork

Everything seems fine, so it’s time to create a horde of space invaders.

A grid of random invaders A daunting horde of space invaders

At this point, our invader node works just like any other node in NodeBox. This is an important concept: custom nodes don’t behave differently from built-in nodes and can do exactly the same things.

Explore and extend

Now that we’ve created our base invader character, we can add features to it to make it more appealing. As an example, we’ll give them all a different fill color:

Colored invaders

Good practices

When designing subnetworks for yourself, or for other people, it makes sense to follow a set of common guidelines. Creating a subnetwork is much like designing the GUI for an application: in the end, you decide which buttons and sliders are available, but users will expect some level of consistency.