# Connections

### Getting Started

### Learning

### Nodes

### Nodes Properties

### Connections

### Custom Variables

### Simulations

### Collaboration

### Unity Plugin (UP) & API

### Account & Billing

## Labels, Formulas, Intervals

- Labels are purely descriptive
- Formulas are used to set the flow or Resources
- Intervals, a special field for inputting the cadence of the flow of Resources

Labels can be applied to Nodes and Connections and are purely descriptive. Use them to organizse your diagram and annotate components for better readability. They will also be listed in the exported Google Sheet, when you are using the functionality to Export to Google Drive.

Formulas are applied to Connections (or Registers). Formulas determine the rate at which Resources flow or how the diagram’s State changes, depending on which type of Connections they are used.

Formulas on Resource Connections dictate how Resources flow between Nodes.

Here are the types of Formulas supported by Resource Connections:

Types | Format | Examples |

flow rate | x | 0; 2 ; 13; 0.5 |

random flow rate | Dx; yDx; x% | D6; 2D5; D3-D2; 20%; 50% |

multipliers | x*y | 250%; 3D3 |

all resources | all | all |

Formulas attached to State Connections indicate the effects of state and state changes on other elements in the diagram.

Here are the Formulas types you can use, and to which types of State Connection they can be applied:

Types | Format | Examples | Applicable to |

modifiers | +; -; +x; -x; +x% | +; -; +2; -0.3; +5%; -2% | value modifiers; node modifiers |

interval modifiers | +xi; -xi | +2i; -1i | value modifiers |

probabilities | x%; x | 20%; 3 | triggers after a gate |

conditions | ==x; !=x; >=x; | ==0; !=2; >=4; | activators; triggers after a gate |

range (conditions) | x..y | 2..5; 4..7 | activators; triggers after a gate |

trigger maker | * | * | triggers |

trigger maker | ! | ! | revers triggers |

overwrite | = | = | value modifiers; node modifiers |

Use `=`

on a State Connection to overwrite the Formula on a State Connection or the value of a Node.

In the example above, you can experiment how changes in the input Nodes can overwrite the values of target Formulas or of target Nodes.

**Formula Modifier: **before hitting Play, the Formula on the Resource Connection between the Source and the Pool is 10. However, upon hitting Play, the Formula will be overwritten, and it will equal the value of the Modifier Pool.

**Node Modifier**: before hitting Play, there are 500 Resources in the Target Pool. After hitting Play, any change to the Interactive Register will be reflected in the number of Resources contained by the Target Pool.

**In short:**

- Use “=” to overwrite Node values.
- Use “+1” if the State Connection’s output Node needs to react to changes made by other inputs.

Here’s a diagram explaining the difference between the two operators:

**Note**: Click on the double-edged Drains to notice the difference in behaviour.

And a short video explaining this:

You may want a Node in your diagram to be activated less than every Step. Use Intervals to do this, as in the example below.

In the example above, the Source will produce 3 Resources every 2 Steps.

**You can use random flow rates with Intervals**.

The example above will produce between 1 and 6 Resources every 3 steps.

**Intervals can be random as well**.

The above setup produces 1 Resource every 3 to 6 steps.

Random Intervals can be a good way to keep the player’s attention on the game.

You can even use a production rate of D6|D6, which indicates between 1 and 6 Resources are produced every 1 to 6 steps.

**Intervals can also be modified dynamically**. Formula Modifiers that have an `i`

as a unit of their modification (for example, `+1i`

or `-3i`

) will change their target’s Interval.

In the example above, the Difficulty initially increases 1 Difficulty point every 2 Steps (1|2). By adding the Interactive Register with the Formula Modifier `+1i,`

we’re able to change the interval dynamically. Play around with the Interactive Register, to increase or decrease the interval at which Difficulty Points accumulate for our player. (Hint: watch the Steps count next to the Reset button to track changes.)

You can combine conditions and math expressions in the same formula (both for registers and for custom variables). If you want the math expression to calculate only when the condition is true you can use the ***** operator to combine them.

As you can see in the image above, you replace the “and” and “or” conditions using multiplication and addition, respectively.

**and(largerEq(a,100),smaller(a,200))** is the same as **largerEq(a,100)*smaller(a,200) **just shorter.

**Example 1:**

largerEq(a,2)*(c+4)

In this case, (c+4) will only be calculated if **a** is larger than or equal to 2.

Please note that this condition will return 1 if it is true and 0 if it is false. Therefore, if the condition is false, the math expression will be multiplied by 0, returning 0 as the result.

**Example 2:**

largerEq(a,100)*smaller(a,200) → It is true when a is larger than or equal to 100 and smaller than 200

smaller(a,100)+larger(a,200) → It is true when a is smaller than 100 or larger than 200.