Game Development Reference
In-Depth Information
Looking back at our data table, the sum of the eight scores is 163.6. Therefore,
the weight of our first option would be
Rounded off to an edge-friendly integer, the Weight of our first bucket is 21.
Checking our accuracy, we find that 21 is 25.9% of 163.6. This is reasonably close
to the 25.8% that this option represented before. Applying this method to the other
options, we arrive at the following new data:
Name
Weapon
Score
Weight
Edge
%
Evil Genius
R/L
7.7
21
21
25.9
Boss Man
R/L
8.5
19
40
23.5
Baddie 3
R/L
18.1
9
49
11.1
Evilmeister
R/L
19.3
8
57
9.9
Evil Genius
M/G
22.6
7
64
8.6
Baddie 3
Shotgun
26.9
6
70
7.4
Baddie 3
M/G
27.4
6
76
7.4
Baddie 2
R/L
33.1
5
81
6.2
For those of us who are curious, if we had still been using the previous method
of generating weights to arrive at this set, we would have needed to use a coefficient
of 21. Of course, we had no way of knowing that ahead of time, nor did we have any
reasonable method of guessing it. (Any guess we had used may not have worked for
some arrangements of data, anyway.)
A glance down the list shows that our granularity is such that we still show the
subtlety of variation between the options. The only two items that have the same
weight are the sixth and seventh options. Looking at their scores, however, we have
to concede that they were almost identical anyway. For our purposes, the 0.1% dif-
ference is loose change.
More importantly, our weights are now integers; therefore, our edges are now
integers as well. By generating a random number between 0 and 81, we can select a
random option whose rate of occurrence reflects the percentages shown. Our agent
is now still reasonable, but neither rigidly predictable nor boring. Out of the 32 orig-
inal possibilities, we will observe our agent selecting from among the eight best
options proportionally distributed by their relative merit.
 
Search WWH ::




Custom Search