### Evolution

Documentation

Delays & Queues

## Delays & Queues

In many games, producing, consuming, and trading resources takes time. The time it requires to complete an action might be crucial for the game balance – think about all the games out there with a time-based economy.

Same Node, 2 functions

success

In a Machinations diagram, use a Delay Node to delay the flow of Resources as they get distributed in your diagram.

A Delay is represented by a small circle with an hourglass inside.

warning

The Formula on the Delayâ€™s output connection indicates how many time steps a Resource is delayed.

Note that this is different from most Formulas on Resource Connections, which ordinarily represent a flow rate.

This time is dynamic, it can be change by other elements in the diagram via Formula Modifiers.

ðŸ”§ In the Delay example below, play the diagram Step by Step. Notice the counter in the play bar (next to the Reset Button) and the flow of Soldiers through the model. It takes 5 time Steps to train a Soldier.

Here’s the step-by-step rundown:
Step 1: 3 Gold are converted into a Soldier & sent to the Training facility (Delay node)
Step 2: First Soldier is in training (delayed), and a second one is commissioned
Steps 3 – 5: both Soldiers are in training (delayed)
Step 6: First Soldier is pushed to the Soldiers’ Pool. The second is still in training
Step 7: Second Soldier is sent to the Soldiers’ Pool

A Delay can process multiple Resources simultaneously. This means that all incoming Resources are delayed for the specified number of time steps regardless of the number of Resources currently being delayed.

info

Other elements in the diagram can change the delay setting through Formula Modifiers or triggers – Buffer diagram below.

Or you can specify a random delay time using the dice notation or custom variables.

success

Delays can be turned into Queues. A Queue has 2 hourglass symbols instead of one.

Queues process only one Resource at a time.

ðŸ”§ In the Queue example below, play the diagram (Step by Step). In this case, orders from Build are queued and processed one at a time every 5 Time Steps.

Step-by-step rundown:
Step 1: Three Gold are converted into a Soldier & sent to the Training facility (Queue)
Step 2: Initial Soldier is being trained (queued) for 1 step. Another three Gold are converted into a Soldier & sent to the Training facility (Queue), but their training is not started
Step 3-5: the first Soldier is being trained & the second Soldier awaits in queue
Step 6: the first Soldier gets pushed to the Soldiers’ Pool & the second Soldier starts their training
Step 6-10: second Soldier is in training
Step 11: the second Soldier gets pushed to the Soldiers’ Pool

success

Delays and Queues can use State Connections that communicate the number of Resources they are currently processing (including the number of Resources waiting in a Queue to be processed).

See diagram below.

Contents

Features

Roles

Templates

Pricing

Resources

Company