Unity Plugin (UP) & API
Resource Connections transfer Resources between Nodes.
- Label – descriptive text, annotations
- Formula – Resource Connections can transfer Resources at different rates. The Formula on the Resource Connection indicates how many Resources are transferred
- Interval – The amount of Steps between transfers. Use your model requires to transfer Resources every “x” Steps. Eg: Formula = 1; Interval = 3 means 1 Resource is transferred every 3 Steps
- A Resource Connection may transfer an unlimited number of Resources in a single time step by using
allas the Formula
- A Resource Connection will blink if there are not enough Resources to be transferred, or if the Resources available can’t be accepted by the Target (eg. in a colour coded diagram)
- There are multiple rates at which Resources can flow in a diagram (apart from the examples presented in this article). For more depth, make sure you check out:
The transfer of Resources may be set to
Interval (default) or
Interval: All Resources are transferred individually, within 1 Step. If there are more Resources being transferred between 2 Nodes, each of them will be treated as individual entities. The changes to the state of the target Node will be updated for each Resource that consecutively reaches the Target (within the same Step).
Instant: All Resources are transferred simultaneously, at the beginning of the Step.
This is an important thing to take into account if you have Nodes that are influenced by state changes on your diagram. Here’s an example.
In the examples above, the Registers change along with the state changes the Pools go through.
In the red example, where the Resource Connection is set to
interval, the Register will gradually reach 5 and the execution will stop mid-way, due to the End Condition being triggered.
In the blue example, the transfer happens instantly, at the beginning of the Step, so all 10 Resources reach their Target, and the End Condition never triggers.
Notice: When you hit Play, the Pools and Registers on the right are instantly updated to 10, whereas the example on the left takes into account the Speed set for the transfer (3 seconds).
Use Filter if your model requires the Resource Connection to transfer only a certain type of Resource.
Use the Shuffle Origin option in a Resource Connection’s Properties panel to randomize the transfer of differently coloured Resources coming from the same origin Node.
By default, Resources from multiple Sources are transferred according to the LIFO principle (last in, first out). When using Shuffle Origin, Resources will be transferred randomly from their origin to the target Node.
For emphasis, in the example above, we used Colour Filter.
Machinations diagrams do not handle fractional values.
To emulate fractional values you can express your game’s Resources in subunits, so that
1 subunit = 1 Resource
An analogy for this would be working with the amount in ¢ (cents) instead of the amount in $ (dollars). To work with transferring 3.14 Resources, you’d need to multiply the whole flow by 100, resulting in 314 Resources.