How are Damage Types Used

For ideas on how to make Second Age a better shard. Can it get any better? Maybe.
Forum rules
Posts in this forum are expected to be constructive, realistic and civil. Inflamatory or off topic posts will be removed.
User avatar
MatronDeWinter
UOSA Donor!!
UOSA Donor!!
Posts: 7249
Joined: Wed Mar 04, 2009 3:35 am
Location: 你的錢包

Re: How are Damage Types Used

Post by MatronDeWinter »

Kaivan wrote: If anyone is interested in the explanation, I am happy to explain how we know that the weapon speed and damages are correct (although, the explanation is long).
Kaivan, I'm late to the party here, but I am very interested in this explanation.

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: How are Damage Types Used

Post by Kaivan »

I'll draft an explanation in the near future. Please bear in mind that this will be quite long, as there are several things that connect together to give us the information we need, and in a lot of areas, there will be at least some reference to code in the scripts or the core of the demo.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: How are Damage Types Used

Post by Kaivan »

I apologize for not following up on this earlier. This explanation will be broken up into multiple posts where each focuses on a specific point of how we determined the weapon and armor statistics. This first post will outline the behavior of the blacksmithy script in the demo as it relates to internally calculated values:

To understand how we know the accuracy of armor and weapon stats, we need to first look at how the demo blacksmithy script calculates difficulties for creating items, as well as some primer information on how the scripts themselves work.

In the demo, when a script is attached to an object, a particular trigger we call the created trigger executes. This piece of code handles any necessary initialization for a script that may be needed later on when the script is first created. Some scripts also contain another trigger called the objectloaded trigger. This code triggers when an object is loaded into memory, and does much the same thing.

In the demo, the blacksmith script has both a created and objectloaded trigger, and both contain the following code:

Code: Select all

{
  Q4Y8();
  return(1);
}
This code runs the function Q4Y8, which is responsible for checking and setting up a global array stored on the server. The relevant code that begins this process is as follows:

Code: Select all

void Q4Y8()
{
  if(hasObjVar(this, "debugSkillInfo"))
  {
    deleteArray(0);
  }
  if(isArrayInit(0))
  {
    return();
  }
The above code does two things. First it will delete the global array stored at index 0 if a particular variable is present on the object. Then it checks to see if the global array stored at index 0 in the server memory is present (initialized) or not (which it will never be if the object variable exists). If the array is present, then the function exits and the trigger finishes. However, if the array is not present then the script continues with some code that builds this array. The significant point of this explanation is to note a few things. First, blacksmithy references a global array stored on the server that holds all of the relevant information about items and their difficulties. This differs from other crafting skills that all set up their menus based on internally stored lists of information. Second, this allows for a much more efficient design with a single table serving all items with the blacksmithy script. Third, this array is re-calculated every time that the server comes back up (assuming the array is not intialized on server start), which allows the blacksmithy script to stay up to date with the latest changes to weapons and armor via the template files. This is how OSI ended up with two different sets of statistics for weapon types, one from before the first weapon patch on 2/12/98, and one afterwards.

So, beyond the beginning piece of the script shown above, the rest of the script builds the global array for blacksmithy. This entails building a 61 row, 6 column, array where each of the sub-menu categories, and specific items are stored. For each row, the 6 corresponding column entries are as follows:
  • Column 1: Item ID
  • Column 2: Hue
  • Column 3: String description of the row item.
  • Column 4: Sub category layer identifier
  • Column 5: Resources required (metal)
  • Column 6: Internally calculated value
For these 6 columns, each row entries fall into two categories; sub-category headers (i.e. build armor) & specific entries (i.e. build a longsword). Since sub-category headers are not of concern, they aren't covered, so, let's take a look at the properties of specific items. Among specific item entries, columns 1 through 4 are of minimal interest, it is primarily columns 5 and 6 that concern us. Specifically, we want to know how the script calculates the internal values for column 6, which is partially dependent on the resources (column 5) required to make the item. This calculation for column 6 is very important to item difficulties and is calculated as follows:
  • For weapons: Average weapon damage * weapon speed / 12 + required resources
  • For armor: Base armor class * 2 + required resources
These different calculations make up the interal values stored in column 6.

Once a value has been calculated for column 6, the function then performs some recursive calculations using these new values in column 6. This starts by calculating the range between the highest and lowest value among all specific item entries stored in column 6. Then, this range is used in a calculation that recursively replaces the values stored in column 6 for each specific item using the following equation:

Code: Select all

new value for column 6 = (old value for column 6 - old minimum value from all column 6 entries) * 1000 / range
This new internal value represents the difficulty for the item.

To give you an example of what happens, consider the following:

One of the rows in the array is for a buckler. The armor rating for a buckler is 7, and a buckler takes 10 metal to create. This makes the initial calculation for column 6 equal to 24. Another row in the array is for a platemail tunic which has an armor rating of 30, and requires 25 metal to make. This makes it's initial calculation for row 6 equal to 85. These two rows also happen to have the highest and lowest values among all rows, thus making the range between them 61. Finally, a third row in the array is for a halberd. The halberd has an average damage of 22, a speed of 25, and takes 20 metal to produce (on the demo). This creates an initial value for column 6 of 65. Using these 3 values and the range, let's calculate the new values for column 6:

Buckler: (24 - 24) * 1000 / 61 = 0
Platemail: (85 - 24) * 1000 / 61 = 1000
Halberd: (65 - 24) * 1000 / 61 = 672

The new numbers calculated above become the final values for column 6 for each of those rows, and these values represent the actual difficulty check for creating the item.

Using the example numbers above, we can see the method by which the difficulties of items are set. The lowest and highest internal values mark the least and most difficult items to create, and all other difficulties lie in-between these two boundaries and use their own properties to determine their relative difficulty compared to the two extremes. The take home is this: Item difficulties are on a relative scale between the least and most difficult items.

More to come in a second post, probably tomorrow.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: How are Damage Types Used

Post by Kaivan »

Extending on the explanation above for how the internal difficulties are calculated we can use those values to obtain a precise value for the minimum skill needed to create an item. While these difficulties had to be painstakingly collected by Stratics during the era, we have the luxury of just being able to look at the code. Specifically, there is a core server function that is regularly used by the scripts called getSkillSuccessChance, which give you the chance for succeeding at a given skill check with a range from 0 to 1000. This particular skill check is also referenced as part of another function called testAndLearnSkill, which checks to see if you have a chance to succeed at a skill check before testing to see if you actually succeed. The formula for getSkillSuccessChance, courtesy of Batlin, is as follows:

Code: Select all

(this->GetSkillLevelReal(SkillNumber, 0) - Diff) * 100 / Focus) + 500;
and the formula is referenced either either directly, like so:

Code: Select all

integer success = getSkillSuccessChance(this, 0x23, 0x0C * getObjVar(usedon, "petCanTame"), 0x32)
or indirectly such as the following line from the blacksmithy script:

Code: Select all

testAndLearnSkill(Q62D, 0x07, getArrayIntElem(0x00, 0x05, Q5NY), 0x32);
The fields of getSkillSuccessChance are as follows:
  • The first value refers to the mobile that the check is being run on. This is the skill user.
  • The second value is the skill number. This is the number that is put into the GetSkillLevelReal check seen in the first code bit. The number obtained from that check ranges from 0 to 1000.
  • The third value is Diff, or the difficulty. Depending on the conditions, this variable will be very different at times, and is typically derived via some sort of equation.
  • The last value is the Focus. This is a variable that typically comes in one of two sizes, 40 or 50. This variable is used to control the advancement of the success rate for the skill, and by extension, the point where it is possible to succeed at a certain skill check.
In the context of the blacksmithy skill, the getSkillSuccessChance function is checked in the following way:

Code: Select all

getSkillSuccessChance(blacksmith, blacksmith skill, calculated difficulty for crafting the chosen item, focus value);
Using the basic success chance formula at GM skill, a Focus of 50 (from the example blacksmithy code), and the difficulty value for a platemail tunic, we can give ourselves a starting point to work with using the success formula:

Code: Select all

(1000 - 1000) * 100 / 50 + 500 = 500
So, at GM skill you have a 50% chance to create a platemail tunic. However, this alone does not tell us the minimum skill required to create a platemail tunic. Of course, by evaluating the actual success formula, it is possible to calculate this number yourself using the Focus value. Since we know the focus value for blacksmithy is 50, we can observe that the portion of the success chance formula that says 100 / Focus can be reduced to 100 / 50 = 2 in this instance. In practice, this portion of the equation actually serves as a 'multiplier' (you could say it 'focuses' the effects of each skill point) effect that modifies the improvement in success rates that each 0.1 point of skill yeilds for a given activity (a multiplier of 2 yields 0.2% success chance, a multiplier of 2.5 yields 0.25%, etc.). Of course, this particular trait works both ways, which means we can backtrack to the minimum required skill for an item. Plugging the multiplier of 2 in place of the 100 / 50, it's easy to see that a value of -250 for the first part of the success equation (skill - difficulty) times 2 will produce a net result of 0. Thus, for any blacksmithy item, the difficulty (the value in column 6) minus 250 represents the skill level that will produce a 0% chance to produce the item. This value actually turns out to be the same value that the blacksmithing menu will actually allow you to see a particular item on the list as well. For the platemail tunic, the minimum skill is 75.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: How are Damage Types Used

Post by Kaivan »

Extending this method from the platemail tunic, we can calculate any minimum skill value for any piece of armor or weaponry. We can also indirectly track any changes to item stats based on the resulting change to it's difficulty to smith, due to the relative nature of smithing difficulties. To give you an example, let's look at the broadsword in the demo. The speed for the broadsword is 45, the damage is 2-19, the metal required to craft it is 10, and the range is 61 as before, which yields the following calculations:

10 * 45 / 12 + 10 = 47
(47 - 24) * 1000 / 61 = 377

Which yields a minimum skill of 12.7 (377 - 250). Now, applying the equation to the values found on the October 99 archive of the weapons page, we find that the speed is still 45, the damage range is 5 - 29, the metal required is still 10, and the range is still 61. These numbers give us:

17 * 45 / 12 + 10 = 73
(73 - 24) * 1000 / 61 = 803

Which yields a minimum skill of 55.3 - a substantial amount higher than the demo calculation.

Using the above calculation, we can now give ourselves two different sources that together corroborate the accuracy of the weapon statistics and eachother. Specifically, the October 1999 stratics archive for weapon damages, and the April 1999 archive for the Blacksmithing guide. Aside from a few notable exceptions, most information contained in both guides are extremely close with only minor errors (off by 0.1 or 0.2 in most cases which cannot account for different statisics).

Extending on the previous calculations even further, we can look forward into UOR and see how things changed. For anyone who actually played at that time, you may recall that the base armor rating of platemail was increased from 30 to 40 at the release of UOR. This had the effect of modifying the difficulty of all other blacksmithy items. To extend on our broadsword example, let's run the UOR calculation. Weapon speed, damage, and resources remained identical, but the range changed from 61 to 81 due to the increase in the base armor of platemail:

17 * 45 / 12 + 10 = 73
(73 - 24) * 1000 / 81 = 604

Which yields a minimum skill of 35.4.

These numbers can be corroborated with the June 2002 stratics archive on blacksmithy which shows the same value for the broadsword, and other items, which were directly reported to the player via the newer crafting menu. Thus, the theory for calculating the minimum skill for creating an item proves accurate during UOR, and since blacksmithy weapons did not have their values changed during T2A, relative to UOR, this method is reliable for our era as well.

Interestingly enough, this is the exact method that we used to determine that the katana necessarily had a speed of 58. Running the calculation...

15 * 58 / 12 + 8 = 80
(80 - 24) * 1000 / 61 = 918

...the minimum skill required to create the katana is 66.8 skill, and if you refer to the stratics table, you will find that value to be exactly what they have listed (this value also calculates out for the UOR value at 44.1 skill and matches stratics). Had the value for the katana's speed been 48, the minimum value would have been 47.1 skill, wnich is a significant deviation from the reported value.

Final note: I've specifically left out any explanation on exceptional chances, because this is already a huge explanation as it is. But if needed, I can fill in the details there as well.
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

User avatar
archaicsubrosa77
UOSA Donor!!
UOSA Donor!!
Posts: 3477
Joined: Fri Jul 03, 2009 5:31 pm
Location: Taylor Michigan

Re: How are Damage Types Used

Post by archaicsubrosa77 »

can I ask what the formula for the hally is for smithing? And why do you get different values in the first lines for the formulas even though they are identical for the sword?
Last edited by archaicsubrosa77 on Sat Nov 02, 2013 11:44 pm, edited 2 times in total.
Derrick wrote:I wish it were possible that a mount could be whacked while you are riding it, but to the best of my knowedge it is not.

Kaivan
UOSA Donor!!
UOSA Donor!!
Posts: 2923
Joined: Wed Aug 13, 2008 11:07 pm

Re: How are Damage Types Used

Post by Kaivan »

archaicsubrosa77 wrote:can I ask what the formula for the hally is for smithing? And why do you get different values in the first lines for the formulas even though they are identical?
The formula is explained above in the posts, and the statistics to run the math are provided as well.

Also, what are you referring to when you talk about identical numbers, yet different results?
UOSA Historian and former staff member: August 11, 2008 - June 19, 2016

Useful links for researching T2A Mechanics

Stratics - UO Latest Updates - Newsgroup 1 - Noctalis - UO98.org

User avatar
archaicsubrosa77
UOSA Donor!!
UOSA Donor!!
Posts: 3477
Joined: Fri Jul 03, 2009 5:31 pm
Location: Taylor Michigan

Re: How are Damage Types Used

Post by archaicsubrosa77 »

Kaivan wrote:
archaicsubrosa77 wrote:can I ask what the formula for the hally is for smithing? And why do you get different values in the first lines for the formulas even though they are identical?
The formula is explained above in the posts, and the statistics to run the math are provided as well.

Also, what are you referring to when you talk about identical numbers, yet different results?
never mind I missed 61 and 81
Derrick wrote:I wish it were possible that a mount could be whacked while you are riding it, but to the best of my knowedge it is not.

Post Reply