Create Custom Flow Nodes

3ds Max Interactive comes with a visual programming system for creating your gameplay code, called Flow. This system is ideally suited for quickly prototyping interactive behaviors for your project. It's complete enough for users to build entire projects without writing any actual code at all, since it offers hundreds of built-in nodes that you can use to detect events in the runtime project and carry out actions in response.

You can also extend the possibilities of Flow by creating your own custom nodes. When your custom node gets evaluated at runtime, the engine calls a function that you define in either C or Lua to carry out whatever custom calculations you need.

Custom Flow nodes make new features easily usable by less technical level designers and visual artists who are working on designing scenes and gameplay interactions. This may mean exposing new code that you've added in your project or plug-in, or it may be existing features offered by the engine's Lua or C interfaces that just haven't yet been made available through the built-in Flow nodes.

Do I choose C or Lua?

Lua is a great choice for implementing your Flow nodes because:

C is a great choice because:

Getting started

Regardless of which language you choose, the basic principles are the same: you need to provide an SJSON node definition that defines the characteristics of the node, and you need to provide the engine with the code that should be run when the node is triggered in a project's Flow graphs at runtime. However, the description and implementation are different depending on which language you choose: