Script Nodes

A ScriptNode is a new type of object. It isn’t a display object, else a logical object you can use with different purposes, especially, for expressing simple and complex behaviors.

Until now, user components were the only way you had to add extra functionality to a game object. The ScriptNode is a more powerful and general tool, that you can use with the same purpose.

Basically, a ScriptNode is a logical object you can add to an scene, a game object, or another ScriptNode. But what is even more exciting, is that you can make reusable and extensible script nodes in the same way you make reusable and extensible game objects: using prefabs.

This means, you can make a prefab of a ScriptNode, add custom properties, create variants of the prefab, create nested prefabs, and append script nodes to prefab instances.

This allows expressing complex behaviors combining logical building blocks (ScriptNode prefabs) in a hierarchical structure.

This concept of script nodes is inspired by the visual programming languages and concepts like the behavior tree. However, we don’t pretend to create a complete, full-featured, visual language. Our advice is using the script nodes for making the blocks of repeated behaviors in your game. You can use it for dealing with the UI interface, menu screens, intro screens. You can use it in your gameplay, but not by combining a lot of general-purpose blocks, else by combining blocks you did specifically for your gameplay.

An argument about the advantage of using a visual scripting language is that creators with no traditional programming experience can make a game. But our concept with the script nodes, is that you, the JavaScript programmer, can implement the script nodes “framework” for your game, and deliver it to the game level designer for connecting the scripts with the game objects and scenes. A good start could be the script-nodes-basic project.