Implementing Machinations Diagrams

From MachinationsWiki
Jump to: navigation, search

Previous: Feedback Analysis and Recurrent Patterns, next: Randomness and Nondeterministic Behavior

The online Machinations tool does not only allow users to draw Machinations diagrams, it can also run diagrams. While running, the resources in a diagram flow from node to node and flow rates change according to their distribution. The digital version of the diagrams introduces an extra activation mode, two different modes the nodes can use to push or pull resources, three new types of nodes (End Conditions, Charts, and Artificial Players), and the concept of color-coded resources. All of these are discussed in this section.

New Node Modes

The new activation mode digital Machinations diagrams introduce is the 'starting action' mode. Nodes in this mode fire once when the diagram is started and are marked with an 's' instead of the star used to mark automatic nodes

The Pull Modes of a node specify in more detail how a node pulls resources from another node. There are two different pull modes:

  1. a node pulls as much resources as it can, up to the flow rates of its inputs. If not all resources are available, it still pulls those that are. (default)
  2. a node can be set to pull all or none resources. In this mode, when not all resources are available, none are pulled. Nodes that are in 'all or none' pull mode are marked with an '&' sign.

Conceptually a Converter is a combination of a Drain and a Source and acts as a combination of the two with respect to input and output Resource Connections (See the equivalent pattern below).

These modes also apply to pushing modes. This means that nodes in push mode might be marked with both a 'p' and a '&'.

End Conditions

An End Condition is a node that stops a running diagram when it is activated. It must be the target of a Activator.

End Conditions specify when a diagram has reached an end state and can stop further execution. Usually such a state is reached when a specified number of resources is collected or when a particular resource is completely drained. End conditions need to be activated through an activator, they do not have a activation mode as other nodes do. End conditions can be used to set goals or build simple timers to limit the game's length. Diagrams that have end conditions are suited to 'quick run': instead of displaying the dynamic behavior as it develops over time, it runs the game to its completion immediately. Diagrams can also be run several times in succession, in this case the tool will show which end condition was reached how many times.


Charts can be used to plot the state of pools into a graph. Pools and graphs are connected using node modifiers, but to avoid visual clutter the tool represents these state connections as two small arrows, one leading out of the pool and one leading into the graph. The color of these arrows corresponds with the color of the lines in the graph. The data collected by these graphs can be exported as simple comma separated values to be analyzed further by other tools.

Artificial Players

Artificial Players allow the use of the Machinations tool to simulate players interacting with the diagram. This introduces the possibility of automated multiple tests runs. The implementation of artificial players is rudimentary, but effective. Every line can contain a command which might be preceded by an if statement. Every time the Artificial Player fires it will start at the top of the script and proceed downwards until it finds the first command which it will execute. The next time it will start from the top again. For example, the script in the example below reads:

if (A<5) fire(Produce)
fireRandom(Convert, Convert, Produce)

This script will initially cause the artificial player to Produce, but once it has 5 or more resources on A it has a 2 in 3 chanc e it will start to Convert instead.

Color Coding

In the digital Machinations tool the color of resources is meaningful. If a Resource Connection has a different color than the color of the pool then only those resources which color matches the color of the resource connection can be pulled through that resource connections. This allows different types of resources to be stored on the same pool. Likewise sources and converters producing resources, produce resources in the respective colors of their outputs, when these outputs have a different color than the source or converter. I use the term color-coding to refer to this use of colored resources and resource connections in a Machinations diagram. Label modifiers, node modifiers, and activators which color is different from the color of the node they originate from, act according to the number of resources of that color on the pool. The figure below illustrates how this can be used in a diagram. Color-coded resources are used in the case-study of SimWar.

In this figure source A produces a random number of orange and blue resources every time it is activated. Both are collected at pool B, the number of orange resources on B increases the number of blue resources produced and vice versa. The user can only activate drain C when there are at least 20 red and 20 blue resources on pool C.

Collecting Data

Digital Machinations diagrams offer the opportunity to collect data on the behavior of a game system before the game is built. It allows designers to test typical playing strategies. The artificial players do not have very advanced artificial intelligence, but they can still easily be programmed to follow certain strategies, and will happily do so over thousands of runs. As will become clear in the discussion of SimWar, this can be a valuable tool in identifying dominant strategies and testing the balance in a game. Artifical players can be activated and deactivated individually, allowing the user to define different artificial players set up to represent and experiment with different strategies within a single diagram.

Previous: Feedback Analysis and Recurrent Patterns, next: Randomness and Nondeterministic Behavior