Game Development Reference
In-Depth Information
thisUtilityTower =
UtilityTower( OddsLargeAttackTower, OddsSmallAttackTower );
thisUtilityNoTower =
UtilityNoTower( OddsLargeAttackNoTower, OddsSmallAttackNoTower );
if ( thisUtilityTower > thisUtilityNoTower ) {
return true;
} else {
return false;
}
}
As before, this could be called from code at any point that we needed to make
a determination as to whether or not we should build a tower over our barracks. We
are still ignoring where we are getting the numbers for the attack odds—assuming
that they are being set elsewhere.
Money certainly is an obvious and reasonably measurable commodity to which we
can ascribe value and utility. Even items on which we can hang a price tag, such as
a computer of questionable quality, can be converted to be expressed in terms of
the value of money.
Another commodity, however, is important to consider when discussing the
concept of utility—especially as it corresponds to decision theory. The idea of
time
as having measurable utility is not a foreign concept. After all, we often utter mus-
ings to ourselves or to others along the lines of “if I only had the time to
spend
,�
“but I don't want to
waste
the time,� “it's not
worth
my time,� and “could you
buy
me some time?� Notice that the emphasized words are all ones that can be used in
similar sentences regarding money. Just as we can say we
spend
money and
waste
money, that our money is
worth
something, and we can even
buy
it, we have inter-
nalized a measurement of time as being a measurable quantity against which we can
judge other items.