ProtoFlux

From Resonite Wiki
Revision as of 15:55, 17 February 2024 by FuzzyBot (talk | contribs) (Updating to match new version of source page)

Introduction

Protoflux
The official ProtoFlux logo

ProtoFlux is a Node based scripting language that can be manipulated in 3D space using the ProtoFlux Tool.

ProtoFlux is the crown jewel of our creative tools - the most powerful visual programming language that our experienced team has designed to date, which lets you quickly prototype and build anything from simple interactions to complex games and systems - with full real-time collaboration support and immediate feedback. Build anything from avatar and world interactivity, to complex systems, and games.

https://resonite.com/features.html

Usage

ProtoFlux is represented in the world as nodes that can be selected from the ProtoFlux Node Browser, and spawned from the Protoflux Tool Tip.

You can easily spawn a ProtoFlux Tool from the Resonite Essentials folder included in your Inventory to begin scripting with ProtoFlux (The tip itself is found in the Tools folder in the Essentials Folder).

To view a list of nodes, go to ProtoFlux Browser Version for a style like in game, or go to Alphabetical list of all nodes to see a comprehensive list. Every node page links back to both lists.

To begin using Protoflux first spawn then equip the Protoflux Tool Tip from the folder mentioned above. Once equipped, the Protoflux node browser can be found in you Context menu. To select a node, double click the node with the Protoflux tool. This will make the name of the node appear above the tip to show it has been selected. Then double click, to spawn the selected node.

You can also quick select nodes that already exist by tapping Secondary while pointing at the node.

Nodes can be connected by pointing the laser at a node's connection point and holding Primary (Trigger for most controllers, or Left Click), then dragging the wire and letting go of Primary while pointing at another node's connection point. They can then be cut by intersecting the red line that comes out the tip of the Protoflux Tip while holding Primary.

Interfacing With Components / Slots

To change or read the properties of a slot's or component's properties, grab with your controller (or right click) while pointing at a given field name with the Protoflux tip (For example, point at and grab the spot where it says 'Position' on a slot). While grabbing the field with the Protoflux tip, open your Context menu. This will give you three options.

Source: This will spawn a node that references the source of the property you were holding. This is used to both read the value of the field or to write to it using Protoflux.

Drive: This will spawn a node to allow you to continuously locally write a value to the variable you were holding.

Reference: This will spawn a node to allow you to get the reference to the field of the given value. This is useful for nodes like ProtoFlux:Tween Value that require a reference to the value it is changing.


Packing / Unpacking Protoflux

To pack Protoflux, hold Secondary while pointing at a group of Protoflux using the Protoflux Tip. The Protoflux should become light blue, this indicates it has been selected (This also makes the Protoflux that is selected act as one object, allowing you to easily move groups of Protoflux around).

Once the Protoflux has been selected, make an empty Slot using the Inspector. This will be the slot the Protoflux is packed into. To then pack the Protoflux, grab the slot using the left side of the Inspector so that it's name is above the Protoflux Tip. While you are grabbing it, open your Context menu and select Pack Into. Once packed, the Protoflux will still function like normal, but will no longer show it's visuals and will apply some optimizations.

To then unpack it, grab the same slot you packed it into and open your context menu. There should now be an option to unpack the Protoflux.


Variables

In ProtoFlux, there are 3 types of generic variables:

The simplest type of variable is a Data Model Store. It's automatically synced to all users upon being written to. Most simple scripts can be done entirely with these, but it can impact performance if overused.

The natural progression down the list is a Store. It's similar to standard variables in most languages. It does not get synced over the network, which alleviates the overhead of doing so, but could lead to desync.

Lastly, we have locals. They're instanced for different execution chains, so if your ProtoFlux is called twice at once, you can read from and write to the variable from both contexts, they will each use a unique instance of the variable that gets discarded when that execution ends.