Game Development Reference
In-Depth Information
Reverse triggers can also be used to trigger end conditions to make a game stop. For
example, in Figure 6.11 this construction is used to end a game when a player takes
more damage after she has lost all hit points. (In the figure the damage is caused by
the user clicking the interactive damage drain. Obviously in most games damage will
be caused by triggers produced by other mechanisms.)
FIGURe 6.11
ending a game when
a player takes damage
when she is out of
hit points.
Color-Coded Diagrams
Machinations diagrams can include color coding to help you distinguish among dif-
ferent types of resources as they flow around. To create a color-coded diagram in the
online tool, simply select the Color-Coded option in the diagram settings dialog in
the side panel.
In a color-coded Machinations diagram, the color of resources and connections is
meaningful. If a resource connection has a different color than its source, it will
pull only resources of its own color. Likewise, if a state connection has a different
color from its source, it will respond only to the resources of that color and ignore
all other resources. Color-coding allows you to store different resources in the same
pool, and for certain games this is very useful. Later in this chapter, we'll show how
color-coding can be used to effectively model different unit types in a strategy game.
T IP if you don't check
the color-coded option
in the tool, you can still
color elements of your
diagram for illustra-
tion purposes, but the
simulation will act as
if everything is all the
same color.
In a color-coded diagram, one source or converter can produce different colored
resources if its outputs are of a different color than the source or converter itself.
Gates can use different colored outputs to sort resources of different colors.
Figure 6.12 illustrates how color coding can be used. In this figure, source A pro-
duces a random number of orange and blue resources every time it is activated. Both
are collected at pool B. The number of orange resources in B increases the number
of blue resources produced at A, and vice versa. The user can activate drain C only
when there are at least 20 orange and 20 blue resources in pool B.
FIGURe 6.12
a color-coded diagram
In a color-coded diagram, a gate can be used to change the colors of resources that
pass it. If the gate has color-coded outputs, it will try to sort resources by their
color, sending red resources along a red output, and so on. However, if the incom-
ing resource color doesn't match any of the outputs, the gate selects an appropriate
output (based on random numbers if it is a random gate or spreading the resources
according to the weighting of the outputs if it is a deterministic gate) and changes
 
Search WWH ::




Custom Search