Game Development Reference
In-Depth Information
FIGURe 6.8
Building orders are
queued and executed
one at a time.
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). This can be useful to create timed effects. For example
in Figure 6.9 , activating delay A will activate source B for 10 steps. You can activate
the delay as long as there are resources on pool C. A construction like this can be
used to improve the construction discussed for power pills in Pac-Man in the section
“Power Pills” in Chapter 5.
FIGURe 6.9
Using a delay to create
a timed effect
Reverse Triggers
In some games, bad things happen when the player doesn't have the resources
required by an automatic or randomly triggered element. For example, in Civilization
when the player runs out of gold to pay the upkeep for his cities' improvements,
the game automatically sells some of them. To simulate this type of event, the
Machinations diagrams include a reverse trigger. A reverse trigger is a state connec-
tion that is labeled with a !. If its source node tries to pull resources but cannot pull
all resources as indicated by the source's input connections, the reverse trigger will
fire its target node. Figure 6.10 illustrates how a reverse trigger can be used to model
the automatic sale of city improvements in Civilization .
FIGURe 6.10
automatic sale of a city
improvement when the
player runs out of gold
in Civilization
 
Search WWH ::




Custom Search