Game Development Reference
In-Depth Information
personalities. This equation is known variously as a fitness function or an eva-
luation function, and we will see it again in future chapters. Here the function can
be thought of as a measure of how well each occupation fits the likes of each
The Simulation
The simulation starts a person with 10 days worth of wages in cash and runs for
1,000 work days. Each day, the simulation asks the person to pick an occupation
from the seven available. This decision will be influenced by the amount of
available cash and the person's particular way of evaluating choices. The simu-
lation will not allow the person to pick an occupation unless he or she has at least
twice the cost of the particular occupation in cash. If the person picks a different
job than the day before, the simulation outputs the results from the prior
occupation. Then the simulation takes the selected job and randomly determines
success or failure according to the odds. It deducts costs and applies gains or
losses to the person's cash. At the end of the day, the simulation deducts living
expenses based on the person's cash. The simulation brackets people as rich,
doing okay, poor, and almost broke with commensurate expense levels. People
who have negative cash are declared bankrupt, and their cash is mercifully reset
to zero.
There are seven occupations available to our simulated people. An occupation
carries a name and four items of numerical data:
n The probability that the simulated person will succeed at the job on any
given day, denoted as P. The probability value is given as a percent, such
as 99.0 percent, but is stored as a decimal, as in 0.99.
n The fixed cost of each attempt at participating in the occupation, denoted
as C. This cost is spent every time the simulated person attempts the
occupation, whether he or she succeeds or not.
n The financial gain that the simulated player receives when he or she
succeeds at an occupation. Gain is denoted as G.
n The financial loss the player incurs when he or she fails an attempted
occupation. The potential loss is denoted as L.
Search Nedrilad ::

Custom Search