User:Oribix/Sandbox

From Destiny 2 Wiki
Jump to: navigation, search

Calculation

Bungie provides stats for every weapon in their API. Every weapon has a group of data labeled investment stats and another labeled stats. The investment stats are the hidden layer stats and the stats are the presentation layer stats.

The hidden layer stats are the weapon's "true stats". The hidden layer stats are then pushed through an interpolation function which calculates the presentation layer stats. The presentation layer stats are pre-calculated in Bungie's API and are used to manipulate in game mechanics.

Interpolation Functions

Every weapon family has a DestinyStatGroupDefinition which governs each individual weapon stat's behavior. DestinyStatGroupDefinition objects have data in them which define behavior for each stat on a weapon.

{
  // unique hash identifying the particular stat.
  "statHash": 123456789,

  //The maximum value allowed for the stat
  "maximumValue": 100,

  "displayAsNumeric": false,

  /* 
   * The interpolation function's data points. This constructs the function's behavior.
   * Data points take the form of value-weight pairs.
   * For the below function, an input value of 0 maps to an output of 10.
   * The same can be said for 70 -> 50 and 100 -> 100
   */
  "displayInterpolation": [
	{"value": 0, "weight": 10},
        {"value": 70, "weight": 50},
	{"value": 100, "weight": 100}
  ]
}

In the above example, displayInterpolation is an interpolation function. This function is responsible for generating stat values in game from the hidden layer stats. Value corresponds to the hidden layer and weight corresponds to the presentation layer. value-weight pairs that do not exist are inferred mathematically using surrounding data points.

Linear Interpolation Functions

Many interpolation functions are simple, linear transformations. Below is the Range interpolation function for all Sniper Rifles.

{
  "statHash": 1240592695, // Range
  "maximumValue": 100,
  "displayAsNumeric": false,
  "displayInterpolation": [
	{"value": 0, "weight": 10},
	{"value": 100, "weight": 100}
  ]
}

As presented in the API, value corresponds to the hidden layer and weight corresponds to the presentation layer. The way this function is configured, the hidden layer stat value of 0 corresponds to a presentation layer stat value of 10. This means that sniper rifles are technically on a scale of 10-100. In this particular case, the interpolation function is:

f(xhidden) = 10 + 0.9xhidden

This is a common scenario and a common interpolation function that occurs for not just range, but for many other stats for many other weapon families. This is why a perk like Accurized Rounds gives +9 Range despite it having a value of +10 range.

Nonlinear Interpolation Functions

Some Interpolation Functions are nonlinear. When investing into stats that have nonlinear interpolation functions, a guardian should take note of plateaus and sudden spikes

Example:
Sniper Rifles have a very nonlinear approach to their Magazine stat. The following is the interpolation function for Magazine for all sniper rifles.

{
  "statHash": 3871231066, // Magazine
  "maximumValue": 100,
  "displayAsNumeric": true,
  "displayInterpolation": [
	{"value": 0, "weight": 3},
	{"value": 20, "weight": 3},
	{"value": 30, "weight": 4},
	{"value": 60, "weight": 4},
	{"value": 70, "weight": 5},
	{"value": 90, "weight": 5},
	{"value": 100, "weight": 7}
  ]
}

Notably, there are plateaus where heavy investment into the Magazine stat would result in literally 0 benefit, while other areas give a large boost to magazine size.

Example 1:
Suppose we have a Long Shadow sniper rifle. Long Shadow has a base hidden layer magazine stat of 50. This give it a base magazine size of 4 bullets. If we apply Appended Mag (+20 Magazine) this will bring it to 70 magazine stat. This gives it a mag size of 5. If we instead apply Extended Mag (+30 Magazine) we get to 80 magazine stat which still resolves to a mag size of 5. Also of note, with Appended Mag and Backup Mag (+30 Magazine), this Long Shadow will have 50 base + 50 invested stats into its magazine for a total of 100. This would bring it to 7 Bullets in the magazine which makes Appended Mag a better pick than Extended Mag.

Example 2:
Consider IKELOS SR v1.0.2 with Tactical Mag. In this case, the Ikelos Sniper has a hidden layer Magazine stat value of 90. With Tactical Mag's +10 Magazine, this brings it to 100 Magazine which is the cap. This means that Tactical Mag is strictly better than Appended Mag and Extended Mag for this sniper. Also worthy of note, this example shows how a nonlinear interpolation function can cause huge jumps in value from small buffs.


Do Not Sell My Personal Information