Game Development Reference
In-Depth Information
State Changes
The state of a Machinations diagram refers to the current distribution of resources
among its nodes. When the resources move from one place to another, the state
changes. In the Machinations framework, you can use state changes to modify the
flow rates of resource connections. In addition, you can trigger nodes to fire, or acti-
vate or deactivate them, in response to changes in resource distribution.
T IP it can be con-
fusing to run the
machinations Tool and
watch a label modifier
causing its target to
decrease even though
the label modifier's
own label is positive.
Think of it this way: a
positive label on the
label modifier causes
its target to follow the
origin node, going up
when the origin goes
up and going down
when it goes down. a
negative label on the
label modifier causes
its target to invert the
origin node, going
down when the origin
goes up, and vice versa.
To make this possible, Machinations offers a second class of connections called state
connections . State connections indicate how changes to the current state of a node
(the number of resources in it) affect something else in the diagram. State connec-
tions are shown as dotted arrows, leading from the controlling node (called the origin )
and going to a target, which can be either a node, a resource connection, or, rarely,
another state connection. Labels on the state connection indicate how it changes
the target. There are four types of state connections that are characterized by the
type of elements they connect and their labels. The four types are label modifiers,
node modifiers, triggers, and activators. We explain them in each of the following
four sections.
LaBeL mOdiFiers
Remember that a label on a resource connection determines how many resources
may move through that connection in a given time step. Label modifiers, connect
an origin node to a target label ( L ) of a resource connection (or even another state
connection). A label modifier indicates how state changes in the origin node (∆ S )
modify the current value of the target label at a current time step ( L t ) as indicated
by the state connection's own label ( M ). The new value takes effect in the next time
step (L t+1 ). The amount of the change in the origin node is multiplied by the label
multiplier's own label. So, if the label modifier says +3 and the origin node increases
by 2, then the target label will increase by 6 in the next time step (it will add 3
twice, once for each change in the origin node). However, if the label modifier says
+3 and the origin node decreases by 2, then the target label will decrease by 6. Thus,
the new value of label (L t+1 ) that is the target of a single label modifier is given by
the following formula:
NOTE This is the
first time we have
used color in a
machinations diagram.
here, it is used only for
visual clarity. however,
the diagrams can also
be color-coded, a
special feature of the
machinations Tool.
We explain color-
coding in more detail
in chapter 6.
L t+1 = L t + M × ∆S
If the label is the target of multiple label modifiers, you will have to take the sum of
all the changes to find the new value:
L t+1 = L t + ∑ (M × ∆S)
The label of a label modifier always starts with a plus or minus symbol. For example,
in Figure 5.11 , every resource added to pool A adds 2 to the value of the resource
flow between pools B and C. Thus, the first time B is activated, one resource flows to
A and three resources flow to C. The second time, one resource still flows to A, but
now five resources flow to C.
 
Search WWH ::




Custom Search