This tutorial introduces Lua scripting for making your own custom nodes within Fugio. From simple data processing to complex logic, Lua is an easy to learn language (that’s also widely used in commercial game development because of its speed) and many other software packages.
An example of using code in Fugio when it makes sense to (trying out the new 2D drawing functionality).
While the node interface is a great way of creating reusable components of code that don’t change much, it isn’t a good fit when you’re trying to define very custom logic. If we stuck to just using nodes, we’d need huge trees of small nodes that would be difficult to build, debug, and maintain, and would have performance overhead implications. Sometimes writing code is just much more efficient in all of these areas, and the design of Fugio recognises this.
Therefore, we can use code, but just when we need to. I feel this offers a good balance between flexibility and simple design.
In other news, there has been a great deal of (boring) work done on refining the editor and hammering out all those little bugs that don’t break things but are just annoying.
The cross-platform installer is under way, with an almost working OSX one done, and a Windows version not far behind. I’m not focussing on Linux right now, as it’s a huge amount of work just supporting two platforms!
I’ve also done some development on the audio side, with the signal generator node receiving quite a bit of focus. I’m using it to build some very basic (at present) synthesisers!
I’ve long been a fan of the Lua scripting language due its incredible speed and relative ease that it can be interfaced with a host application. In this screenshot we can see the new LuaNode that is reading a random number from an input pin, modifying that value and setting an output pin.
While this is a relatively pointless example considering the amazing range of things that could be achieved, it works very well and very quickly!
Scripting is an important feature of Fugio as not all stages of code translates well into nodes. For instance, performing simple maths on one or more values would result in having to use lots of nodes, to store values and apply each operation. With scripting we can pass values in, concisely manipulate these values, and output the values, all in one node.
I’ve implemented a basic but extensible way to pass other types of information to and from Lua, such as colours, vec3’s, etc, so there will be no need to split/join these datatypes into their basic components before passing them into/from the LuaNode.