### Post by zur on Sept 8, 2018 16:54:17 GMT -5

TL;DR Q&A List:

* Rolling with one or more "Preferred" stats rolls a percentile d100, compares it to the minimum and maximum values a stat can be, then generates the stat, resulting in a

* Rolling with zero preferred stats rolls the "Raw" dice for a given racial stat, resulting in a

, which includes the possibility of rolling really low.

* These calculations ignore Racial and Class modifiers (+2 for Warrior, etc.) as they come after the pertinent generation code. Your attributes will be higher/lower depending on what you select in character generation. They also ignore the "Reroll" command, for simplicity's sake.

* The "Stat Label" is unique for every class AND every attribute. You cannot compare a Human wisdom's "Very Good" with a Human strength's "Very Good", nor can you compare those with an Elf Wisdom's "Very Good".

* The only way to get "AI" or "Poor" stats is to roll "Exceptional" or "Below Average" on a given stat and have your Race or Class affect it.

* For any given attribute score, the chance of getting a maximum roll is always a flat ( 1.00%) when using "Preferred" stats, or is dependent on the dice when using "Raw" stats

** Human STR/AGI/END uses 3d4+7, giving a ( 1.56%) of a max value roll. Elven Wisdom uses 4d7+5, giving a (~0.04%) chance of a max value roll.

* When rolling a Human, unless you are specifically going for maximum rolls on STR, END, AGI, and ignore/dump WIS, you have a better chance of getting higher attributes where you want them by using the "Preferred" system.

* When rolling a Human, you will, on average (Between ~6%-11% of the time), have better stat rolls by not prioritizing anything, but you lose the ability to control where those rolls go.

* There is no difference between prioritizing "STR AGI END WIS" and "STR AGI END"

While creating your character, you eventually reach the point where you decide how many attributes to prioritize, and in which order. While pouring through the codebase, I stumbled upon the code that generates your stats. As it turns out, the "Prioritization" uses a completely different method to generate your Stats.

roll_abilities_raw generates the numbers via a traditional method of "Dice" rolling, whereas roll_abilities_preferred uses an interesting, if somewhat convoluted, system to factor in the ability to prioritize any or all statistics. Before continuing, I ask you dear reader.. If you're rolling a half-giant known for their strength, but prioritize wisdom, do you end up with an incredibly weak, but very wise variant?

For actual values of racial rolls, I refer to this thread throughout this post: armageddonmud.boards.net/thread/447/code-details-megathread

If we presume gogogadget's "Stat Ranges By Race" to be accurate, it's obvious that we don't get 3d3+1 strength instead of wisdom. How do you factor in a half-giant's high strength roll and prioritize everything but?

You don't, unfortunately.

When one or more stats are prioritized, the game switches to a percentile d100 system. Each stat is temporarily represented by a percentile roll. If the sum of each stat (STR+END+AGI+WIS) is less than a static variable, AVERAGE_ATTRIBUTE_VALUE=28 * 4 == [112], the game 'silently' rerolls until "The sum of the rolls is at least average". Turns out "Average" in this context doesn't mean d100 average, it means in-game.

The above percentiles aren't arbitrary. If we only look at everything between poor and AI, we're essentially looking at a 1-7 scale. 4/7 = 57.1%, defining the upper limit of the 4th item of the scale, "good".

Anything below this scale is "Poor", while everything above this scale is "Absolutely Incredible."

We still require an actual number to go along with this temporary percentile. The method "

The game feeds the result of convert_attribute_percent_to_range() into an int[] array, where it's used for various game functions.

For example's sake, lets prioritize WIS END AGI STR, and roll 97, 44, 29, and 10, respectively. Their sum, 180, is greater than 112, so this is a "valid" roll. This translates to:

STR - Below Average (10)

AGI - Above Average (29)

WIS - Exceptional (97)

END - Good (44)

At this point, we 'need' to know what race we are so that we can aquire minRange and maxRange. For a human, gogogadget's post shows the following:

We then apply convert_attribute_percent_to_range()..

The game then throws this number into the array, trunciating the decimal as it converts from a float to an int.

There's no doubt that this is an effective way to translate the system over, but the fact remains that we as players have this choice in front of us which system to use to roll our stats. Which is better, a xd4+n system that denies choice, or a d100 system that allows it, and also allows an average of 28 or more per skill? Knowing the minimum the system will allow us for "Preferred" will allow us to extrapolate a necessary "Raw" roll to emulate the same results.

A bit of math tells us the chance of rolling 3d4 and getting at least 5 is 93.75%. Rolling 4d4 and getting at least 7 has a chance of 94.14%. Therefore, the chances of rolling at least "Average" in regards to roll_abilities_raw is:

(.9375 * .9375 * .9414 * .9375) ==

The chances of rolling greater than (28*4=112) on 4d100 is

The following are a few tables displaying the probability of rolling a given attribute:

We can culminate the above and ask, "What is the chance I'll roll N or above using either system for a given stat, when rolling a Human?"

So, what does this mean?

When Generating a Human:

* Using the "Raw" system, you have a marginally better chance at getting

* Using the "Raw" system, you have a much greater

** For WIS, "Raw" chance of the above is

* Using the "Raw" System, the chance of getting

** For WIS, "Raw" chance of the above is

* Conversely, the chance of getting

** For WIS, "Raw" chance of the above is

Lets put this into a practical example. I'm rolling a Human and I want STR and END to be "Very Good" or better. What system do I use?

Raw:

STR: ( 31.26%) of "Very Good" or better

END: ( 31.26%) of "Very Good" or better

==

Preferred:

"Very good" = 58 or better on d100.

* Chance of rolling >= 58 at least twice out of 4d100 =

You should use the Preferred system, preferring STR and END. You likely will not roll maximum, but you do have a

What if I want "Extremely Good" or better STR and END?

Raw:

STR: ( 15.63%) of "Extremely Good" or better

END: ( 15.63%) of "Extremely Good" or better

==

Preferred:

"Extremely good" = 72 or better on d100

* Chance of rolling >= 72 at least twice out of 4d100 =

What if I want "Exceptional" or better STR and END?

Raw:

STR: ( 6.25%) of "Exceptional"

END: ( 6.25%) of "Exceptional"

==

Preferred:

"Exceptional" = 86 or better on d100

* Chance of rolling >= 86 at least twice out of 4d100 =

No surprise, Preferred system gets what you want with a

What if I want Maximum (19) STR and END?

Raw:

STR: ( 1.56

%) of rolling 19

END: ( 1.56

%) of rolling 19

==

Preferred:

Roll of 19 = 100 on d100

Chance of rolling 100 at least twice out of 4d100 =

Continuing the above pattern, but prioritizing three stats:

* The chance of rolling "Very good" or better prioritizing STR, END, AGI is

In short, the ability to put a high roll where you want it is very powerful, statistics wise, even if it makes it far more difficult to actually achieve a maximum roll.

* Rolling with one or more "Preferred" stats rolls a percentile d100, compares it to the minimum and maximum values a stat can be, then generates the stat, resulting in a

**more even random distribution.*** Rolling with zero preferred stats rolls the "Raw" dice for a given racial stat, resulting in a

**bell curve**of possible outcomes, which includes the possibility of rolling really low.

* These calculations ignore Racial and Class modifiers (+2 for Warrior, etc.) as they come after the pertinent generation code. Your attributes will be higher/lower depending on what you select in character generation. They also ignore the "Reroll" command, for simplicity's sake.

* The "Stat Label" is unique for every class AND every attribute. You cannot compare a Human wisdom's "Very Good" with a Human strength's "Very Good", nor can you compare those with an Elf Wisdom's "Very Good".

* The only way to get "AI" or "Poor" stats is to roll "Exceptional" or "Below Average" on a given stat and have your Race or Class affect it.

* For any given attribute score, the chance of getting a maximum roll is always a flat ( 1.00%) when using "Preferred" stats, or is dependent on the dice when using "Raw" stats

** Human STR/AGI/END uses 3d4+7, giving a ( 1.56%) of a max value roll. Elven Wisdom uses 4d7+5, giving a (~0.04%) chance of a max value roll.

* When rolling a Human, unless you are specifically going for maximum rolls on STR, END, AGI, and ignore/dump WIS, you have a better chance of getting higher attributes where you want them by using the "Preferred" system.

* When rolling a Human, you will, on average (Between ~6%-11% of the time), have better stat rolls by not prioritizing anything, but you lose the ability to control where those rolls go.

* There is no difference between prioritizing "STR AGI END WIS" and "STR AGI END"

While creating your character, you eventually reach the point where you decide how many attributes to prioritize, and in which order. While pouring through the codebase, I stumbled upon the code that generates your stats. As it turns out, the "Prioritization" uses a completely different method to generate your Stats.

roll_abilities_raw generates the numbers via a traditional method of "Dice" rolling, whereas roll_abilities_preferred uses an interesting, if somewhat convoluted, system to factor in the ability to prioritize any or all statistics. Before continuing, I ask you dear reader.. If you're rolling a half-giant known for their strength, but prioritize wisdom, do you end up with an incredibly weak, but very wise variant?

For actual values of racial rolls, I refer to this thread throughout this post: armageddonmud.boards.net/thread/447/code-details-megathread

If we presume gogogadget's "Stat Ranges By Race" to be accurate, it's obvious that we don't get 3d3+1 strength instead of wisdom. How do you factor in a half-giant's high strength roll and prioritize everything but?

You don't, unfortunately.

When one or more stats are prioritized, the game switches to a percentile d100 system. Each stat is temporarily represented by a percentile roll. If the sum of each stat (STR+END+AGI+WIS) is less than a static variable, AVERAGE_ATTRIBUTE_VALUE=28 * 4 == [112], the game 'silently' rerolls until "The sum of the rolls is at least average". Turns out "Average" in this context doesn't mean d100 average, it means in-game.

`const char * const how_good_stat[] = {`

"poor", /* < 0% */

"below average", /* 0% - 14% */

"average", /* 15% - 28% */

"above average", /* 29% - 42% */

"good", /* 43% - 57% */

"very good", /* 58% - 71% */

"extremely good", /* 72% - 85% */

"exceptional", /* 86% - 100% */

"absolutely incredible" /* > 100% */

};

The above percentiles aren't arbitrary. If we only look at everything between poor and AI, we're essentially looking at a 1-7 scale. 4/7 = 57.1%, defining the upper limit of the 4th item of the scale, "good".

Anything below this scale is "Poor", while everything above this scale is "Absolutely Incredible."

We still require an actual number to go along with this temporary percentile. The method "

**float convert_attribute_percent_to_range(int roll, int minRange, int maxRange)**" defines this conversion as:`maxRange - minRange = deltaRange`

(deltaRange * attributeRoll / 100) + minRange = ActualAttributeScore

The game feeds the result of convert_attribute_percent_to_range() into an int[] array, where it's used for various game functions.

For example's sake, lets prioritize WIS END AGI STR, and roll 97, 44, 29, and 10, respectively. Their sum, 180, is greater than 112, so this is a "valid" roll. This translates to:

STR - Below Average (10)

AGI - Above Average (29)

WIS - Exceptional (97)

END - Good (44)

At this point, we 'need' to know what race we are so that we can aquire minRange and maxRange. For a human, gogogadget's post shows the following:

`Human: `

Stat Dice Ranges DeltaRange

STR: 3d4+7 (10-19) 19-10 == 9

AGI: 3d4+7 (10-19) 19-10 == 9

WIS: 4d4+4 (8-20) 20-8 == 12

END: 3d4+7 (10-19) 19-10 == 9

We then apply convert_attribute_percent_to_range()..

` float ActualAttributeScore`

STR: ((9 * 10) / 100) + 10 == 10.9

AGI: ((9 * 29) / 100) + 10 == 12.61

WIS: ((12 * 97) / 100) + 8 == 19.64

END: ((9 * 44) / 100) + 10 == 13.96

The game then throws this number into the array, trunciating the decimal as it converts from a float to an int.

`Str = 10`

Agi = 12

Wis = 19

End = 13

There's no doubt that this is an effective way to translate the system over, but the fact remains that we as players have this choice in front of us which system to use to roll our stats. Which is better, a xd4+n system that denies choice, or a d100 system that allows it, and also allows an average of 28 or more per skill? Knowing the minimum the system will allow us for "Preferred" will allow us to extrapolate a necessary "Raw" roll to emulate the same results.

`Human:`

Stat Preferred Raw

STR: 29% "Above Average" == 12 3d4 >= 5, 5+7 == 12

AGI: 28% "Average" == 12 3d4 >= 5, 5+7 == 12

WIS: 29% "Above Average" == 11 4d4 >= 7, 7+4 == 11

END: 28% "Average" == 12 3d4 >= 5, 5+7 == 12

// Note that, while STR and AGI have similiar RAW roles, their

"Label" differs due to the 1%. This is largely ignorable, as the "Stat" command uses a different formula to acquire it (elaborated on in Footnotes, below)

A bit of math tells us the chance of rolling 3d4 and getting at least 5 is 93.75%. Rolling 4d4 and getting at least 7 has a chance of 94.14%. Therefore, the chances of rolling at least "Average" in regards to roll_abilities_raw is:

(.9375 * .9375 * .9414 * .9375) ==

**77.56%**

.The odds of rolling above this "Average" are slightly lower, but this figure is relatively accurate.

The chances of rolling greater than (28*4=112) on 4d100 is

**93.79%.**

The following are a few tables displaying the probability of rolling a given attribute:

`Human:`

STR, END, AGI (3d4+7, 10-19)

(10+N=Stat) d100 Roll Result Preferred Odds(%) Raw roll result Raw Odds(%) Visual Label

9: 100 1 3d4+7 = 19 1.56 Exceptional

8: 89-99 11 3d4+7 = 18 4.69 Exceptional

7: 78-88 11 3d4+7 = 17 9.38 Extremely Good

6: 67-77 11 3d4+7 = 16 15.63 Very Good

5: 56-66 11 3d4+7 = 15 18.75 Good

4: 45-55 11 3d4+7 = 14 18.75 Good

3: 34-44 11 3d4+7 = 13 15.63 Above Average

2: 23-33 11 3d4+7 = 12 9.38 Average

1: 12-22 11 3d4+7 = 11 4.69 Below Average

0: 1-11 11 3d4+7 = 10 1.56 Below Average

`Human:`

WIS (4d4+4, 8-20)

(8+N=Stat) d100 Roll Result Preferred Odds(%) Raw roll result Raw Odds(%) Visual Label

12: 100 1 4d4+4 = 20 0.39 Exceptional

11: 92-99 8 4d4+4 = 19 1.56 Exceptional

10: 84-91 8 4d4+4 = 18 3.91 Extremely Good

9: 75-83 9 4d4+4 = 17 7.81 Extremely Good

8: 67-74 8 4d4+4 = 16 12.11 Very Good

7: 59-66 8 4d4+4 = 15 15.63 Very Good

6: 50-58 9 4d4+4 = 14 17.19 Good

5: 42-49 8 4d4+4 = 13 15.63 Above Average

4: 34-41 8 4d4+4 = 12 12.11 Above Average

3: 25-33 9 4d4+4 = 11 7.81 Average

2: 17-24 8 4d4+4 = 10 3.91 Average

1: 9-16 8 4d4+4 = 9 1.56 Below Average

0: 1-8 8 4d4+4 = 8 0.39 Below Average

We can culminate the above and ask, "What is the chance I'll roll N or above using either system for a given stat, when rolling a Human?"

`Chance of rolling N Human STR/END/AGI or above(%):`

N Raw Preferred Visual Label

19 1.56 1 Exceptional

18 6.25 12. Exceptional

17 15.63 23. Extremely Good

16 31.25 34. Very Good

15 50. 45. Good

14 68.75 56. Good

13 84.38 67. Above Average

12 93.75 78. Average

11 98.44 89. Below Average

10 100. 100. Below Average

`Chance of rolling N Human WIS or above(%):`

N Raw Preferred Visual Label

20 0.39 1. Exceptional

19 1.95 9. Exceptional

18 5.86 17. Extremely Good

17 13.67 26. Extremely Good

16 25.78 34. Very Good

15 41.41 42. Very Good

14 58.59 51. Good

13 74.22 59. Above Average

12 86.33 67. Above Average

11 94.14 76. Average

10 98.05 84. Average

9 99.61 92. Below Average

8 100. 100. Below Average

So, what does this mean?

When Generating a Human:

* Using the "Raw" system, you have a marginally better chance at getting

__maximum__scores in all four abilities (1481 / 100 Billion) than if you use the "Preferred" system (1000 / 100 Billion)* Using the "Raw" system, you have a much greater

**( 68.76%)**chance of getting__between "Above Average" and "Very Good"(Inclusive)__with STR/AGI/END , as compared to the "Preferred" system**( 44.00%)**** For WIS, "Raw" chance of the above is

**( 72.67%)**compared to "Preferred" chance of**( 41.00%)*** Using the "Raw" System, the chance of getting

__"Extremely Good" or above__STR/AGI/END is**( 15.63%).**Using the "Preferred system, this chance is**( 23.00%)**, with a noticeable weight (22 in 23) towards anything not the maximum.** For WIS, "Raw" chance of the above is

**( 13.67%)**, compared to "Preferred" chance of**( 26.00%)**, with noticeable weight (25 in 26) of not achieving maximum value.* Conversely, the chance of getting

__"Average" or below__STR/AGI/END using the "Raw" system is**( 15.63%)**, while the "Preferred" system has a chance of**( 33.00%)**.** For WIS, "Raw" chance of the above is

**( 13.67%)**, compared to "Preffered" chance of**( 33.00%)**

Lets put this into a practical example. I'm rolling a Human and I want STR and END to be "Very Good" or better. What system do I use?

Raw:

STR: ( 31.26%) of "Very Good" or better

END: ( 31.26%) of "Very Good" or better

==

**( 9.77%)**of both being "Very Good" or better.Preferred:

"Very good" = 58 or better on d100.

* Chance of rolling >= 58 at least twice out of 4d100 =

**( 57.59%)**You should use the Preferred system, preferring STR and END. You likely will not roll maximum, but you do have a

**(+47.82%)**of getting what you want over rolling "Raw"What if I want "Extremely Good" or better STR and END?

Raw:

STR: ( 15.63%) of "Extremely Good" or better

END: ( 15.63%) of "Extremely Good" or better

==

**( 2.44%)**of both being "Extremely Good" or betterPreferred:

"Extremely good" = 72 or better on d100

* Chance of rolling >= 72 at least twice out of 4d100 =

**( 33.07%)**

You should still use the Preferred system, prioritizing STR and END. You have a**(+ 30.63%)**of getting what you want over rolling "Raw"What if I want "Exceptional" or better STR and END?

Raw:

STR: ( 6.25%) of "Exceptional"

END: ( 6.25%) of "Exceptional"

==

**( 0.39%)**of both being "ExceptionalPreferred:

"Exceptional" = 86 or better on d100

* Chance of rolling >= 86 at least twice out of 4d100 =

**( 10.95%)**No surprise, Preferred system gets what you want with a

**(+10.56%)**over raw.What if I want Maximum (19) STR and END?

Raw:

STR: ( 1.56

%) of rolling 19

END: ( 1.56

%) of rolling 19

==

**( 0.02%)**of rolling both 19's.Preferred:

Roll of 19 = 100 on d100

Chance of rolling 100 at least twice out of 4d100 =

**( 0.06%)**

Though the margins progressively shrink, "Preffered" system is still your way to go with a**(+0.04%)**chance over rolling RawContinuing the above pattern, but prioritizing three stats:

* The chance of rolling "Very good" or better prioritizing STR, END, AGI is

**( 21.55%)**, compared to "Raw" chance of**( 3.05%)**

* "Extremely Good" Prioritizing STR, END, AGI is**( 7.62%)**compared to "Raw" chance of**(0.38%)**

* "Exceptional" prioritizing STR, END, AGI is**( 1.20%)**compared to "Raw" chance of**( 0.02%)**

* Maximum rolls prioritizing STR, END, AGI is**( 0.0001%)**compared to "Raw" chance of**(0.0003796%)**In short, the ability to put a high roll where you want it is very powerful, statistics wise, even if it makes it far more difficult to actually achieve a maximum roll.