@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.45 → 4.0.0-beta.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1100,13 +1100,15 @@ class DroidTapEvaluator extends SpeedEvaluator {
1100
1100
  * Evaluates the difficulty of tapping the current object, based on:
1101
1101
  *
1102
1102
  * - time between pressing the previous and current object,
1103
+ * - distance between those objects,
1103
1104
  * - how easily they can be cheesed,
1104
1105
  * - and the strain time cap.
1105
1106
  *
1106
1107
  * @param current The current object.
1107
1108
  * @param considerCheesability Whether to consider cheesability.
1109
+ * @param strainTimeCap The strain time to cap the object's strain time to.
1108
1110
  */
1109
- static evaluateDifficultyOf(current, considerCheesability) {
1111
+ static evaluateDifficultyOf(current, considerCheesability, strainTimeCap) {
1110
1112
  if (current.object instanceof osuBase.Spinner ||
1111
1113
  // Exclude overlapping objects that can be tapped at once.
1112
1114
  current.isOverlapping(false)) {
@@ -1115,14 +1117,17 @@ class DroidTapEvaluator extends SpeedEvaluator {
1115
1117
  const doubletapness = considerCheesability
1116
1118
  ? 1 - current.doubletapness
1117
1119
  : 1;
1120
+ const strainTime = strainTimeCap !== undefined
1121
+ ? // We cap the strain time to 50 here as the chance of vibro is higher in any BPM higher than 300.
1122
+ Math.max(50, strainTimeCap, current.strainTime)
1123
+ : current.strainTime;
1118
1124
  let speedBonus = 1;
1119
- if (current.strainTime < this.minSpeedBonus) {
1125
+ if (strainTime < this.minSpeedBonus) {
1120
1126
  speedBonus +=
1121
1127
  0.75 *
1122
- Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - current.strainTime) / 40), 2);
1128
+ Math.pow(osuBase.ErrorFunction.erf((this.minSpeedBonus - strainTime) / 40), 2);
1123
1129
  }
1124
- return ((speedBonus * Math.pow(doubletapness, 1.5) * 1000) /
1125
- current.strainTime);
1130
+ return (speedBonus * Math.pow(doubletapness, 1.5) * 1000) / strainTime;
1126
1131
  }
1127
1132
  }
1128
1133
 
@@ -1130,7 +1135,13 @@ class DroidTapEvaluator extends SpeedEvaluator {
1130
1135
  * Represents the skill required to press keys or tap with regards to keeping up with the speed at which objects need to be hit.
1131
1136
  */
1132
1137
  class DroidTap extends DroidSkill {
1133
- constructor(mods, considerCheesability) {
1138
+ /**
1139
+ * The delta time of hitobjects.
1140
+ */
1141
+ get objectDeltaTimes() {
1142
+ return this._objectDeltaTimes;
1143
+ }
1144
+ constructor(mods, considerCheesability, strainTimeCap) {
1134
1145
  super(mods);
1135
1146
  this.reducedSectionCount = 10;
1136
1147
  this.reducedSectionBaseline = 0.75;
@@ -1139,7 +1150,9 @@ class DroidTap extends DroidSkill {
1139
1150
  this.currentTapStrain = 0;
1140
1151
  this.currentRhythmMultiplier = 0;
1141
1152
  this.skillMultiplier = 1.375;
1153
+ this._objectDeltaTimes = [];
1142
1154
  this.considerCheesability = considerCheesability;
1155
+ this.strainTimeCap = strainTimeCap;
1143
1156
  }
1144
1157
  /**
1145
1158
  * The amount of notes that are relevant to the difficulty.
@@ -1154,11 +1167,31 @@ class DroidTap extends DroidSkill {
1154
1167
  }
1155
1168
  return this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 12 - 6))), 0);
1156
1169
  }
1170
+ /**
1171
+ * The delta time relevant to the difficulty.
1172
+ */
1173
+ relevantDeltaTime() {
1174
+ if (this._objectStrains.length === 0) {
1175
+ return 0;
1176
+ }
1177
+ const maxStrain = Math.max(...this._objectStrains);
1178
+ if (maxStrain === 0) {
1179
+ return 0;
1180
+ }
1181
+ return (this._objectDeltaTimes.reduce((total, next, index) => total +
1182
+ (next * 1) /
1183
+ (1 +
1184
+ Math.exp(-((this._objectStrains[index] / maxStrain) *
1185
+ 25 -
1186
+ 20))), 0) /
1187
+ this._objectStrains.reduce((total, next) => total + 1 / (1 + Math.exp(-((next / maxStrain) * 25 - 20))), 0));
1188
+ }
1157
1189
  strainValueAt(current) {
1158
1190
  this.currentTapStrain *= this.strainDecay(current.strainTime);
1159
1191
  this.currentTapStrain +=
1160
- DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability) * this.skillMultiplier;
1192
+ DroidTapEvaluator.evaluateDifficultyOf(current, this.considerCheesability, this.strainTimeCap) * this.skillMultiplier;
1161
1193
  this.currentRhythmMultiplier = current.rhythmMultiplier;
1194
+ this._objectDeltaTimes.push(current.deltaTime);
1162
1195
  return this.currentTapStrain * current.rhythmMultiplier;
1163
1196
  }
1164
1197
  calculateInitialStrain(time, current) {
@@ -1174,6 +1207,9 @@ class DroidTap extends DroidSkill {
1174
1207
  * @param current The hitobject to save to.
1175
1208
  */
1176
1209
  saveToHitObject(current) {
1210
+ if (this.strainTimeCap !== undefined) {
1211
+ return;
1212
+ }
1177
1213
  const strain = this.currentTapStrain * this.currentRhythmMultiplier;
1178
1214
  if (this.considerCheesability) {
1179
1215
  current.tapStrain = strain;
@@ -1723,6 +1759,8 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1723
1759
  visualSliderFactor: 0,
1724
1760
  possibleThreeFingeredSections: [],
1725
1761
  difficultSliders: [],
1762
+ averageSpeedDeltaTime: 0,
1763
+ vibroFactor: 1,
1726
1764
  };
1727
1765
  this.difficultyMultiplier = 0.18;
1728
1766
  this.mode = osuBase.Modes.droid;
@@ -1780,7 +1818,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1780
1818
  const tapSkillCheese = new DroidTap(this.mods, true);
1781
1819
  const tapSkillNoCheese = new DroidTap(this.mods, false);
1782
1820
  this.calculateSkills(tapSkillCheese, tapSkillNoCheese);
1783
- this.postCalculateTap(tapSkillCheese);
1821
+ const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
1822
+ this.calculateSkills(tapSkillVibro);
1823
+ this.postCalculateTap(tapSkillCheese, tapSkillVibro);
1784
1824
  }
1785
1825
  /**
1786
1826
  * Calculates the rhythm star rating of the beatmap and stores it in this instance.
@@ -1846,8 +1886,10 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1846
1886
  const flashlightSkillWithoutSliders = skills[6];
1847
1887
  const visualSkill = skills[7];
1848
1888
  const visualSkillWithoutSliders = skills[8];
1889
+ const tapSkillVibro = new DroidTap(this.mods, true, tapSkillCheese.relevantDeltaTime());
1890
+ this.calculateSkills(tapSkillVibro);
1849
1891
  this.postCalculateAim(aimSkill, aimSkillWithoutSliders);
1850
- this.postCalculateTap(tapSkillCheese);
1892
+ this.postCalculateTap(tapSkillCheese, tapSkillVibro);
1851
1893
  this.postCalculateRhythm(rhythmSkill);
1852
1894
  this.postCalculateFlashlight(flashlightSkill, flashlightSkillWithoutSliders);
1853
1895
  this.postCalculateVisual(visualSkill, visualSkillWithoutSliders);
@@ -1962,13 +2004,20 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
1962
2004
  * Called after tap skill calculation.
1963
2005
  *
1964
2006
  * @param tapSkillCheese The tap skill that considers cheesing.
2007
+ * @param tapSkillVibro The tap skill that considers vibro.
1965
2008
  */
1966
- postCalculateTap(tapSkillCheese) {
2009
+ postCalculateTap(tapSkillCheese, tapSkillVibro) {
1967
2010
  this.strainPeaks.speed = tapSkillCheese.strainPeaks;
1968
2011
  this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
1969
2012
  ? 0
1970
2013
  : this.starValue(tapSkillCheese.difficultyValue());
2014
+ if (this.tap) {
2015
+ this.attributes.vibroFactor =
2016
+ this.starValue(tapSkillVibro.difficultyValue()) / this.tap;
2017
+ }
1971
2018
  this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
2019
+ this.attributes.averageSpeedDeltaTime =
2020
+ tapSkillCheese.relevantDeltaTime();
1972
2021
  this.attributes.tapDifficultStrainCount =
1973
2022
  tapSkillCheese.countDifficultStrains();
1974
2023
  this.calculateTapAttributes();
@@ -2499,12 +2548,32 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2499
2548
  // Consider notes that are difficult to tap with respect to other notes, but
2500
2549
  // also cap the note count to prevent buffing filler patterns.
2501
2550
  tapValue *= this.calculateDeviationBasedLengthScaling(Math.min(this.difficultyAttributes.speedNoteCount, this.totalHits / 1.45));
2551
+ // Normalize the deviation to 300 BPM.
2552
+ const normalizedDeviation = this.tapDeviation *
2553
+ Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
2554
+ // We expect the player to get 7500/x deviation when doubletapping x BPM.
2555
+ // Using this expectation, we penalize scores with deviation above 25.
2556
+ const averageBPM = 60000 / 4 / this.difficultyAttributes.averageSpeedDeltaTime;
2557
+ const adjustedDeviation = normalizedDeviation *
2558
+ (1 +
2559
+ 1 /
2560
+ (1 +
2561
+ Math.exp(-(normalizedDeviation - 7500 / averageBPM) /
2562
+ ((2 * 300) / averageBPM))));
2502
2563
  // Scale the tap value with tap deviation.
2503
2564
  tapValue *=
2504
2565
  1.05 *
2505
- Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * this.tapDeviation)), 0.6);
2506
- // Scale the tap value with high deviation nerf.
2507
- tapValue *= this.calculateTapHighDeviationNerf();
2566
+ Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.6);
2567
+ // Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
2568
+ // Higher BPMs require more precise tapping. When the deviation is too high,
2569
+ // it can be assumed that the player taps invariant to rhythm.
2570
+ // We harshen the punishment for such scenario.
2571
+ tapValue *=
2572
+ (1 - Math.pow(this.difficultyAttributes.vibroFactor, 6)) /
2573
+ (1 +
2574
+ Math.exp((this._tapDeviation - 7500 / averageBPM) /
2575
+ ((2 * 300) / averageBPM))) +
2576
+ Math.pow(this.difficultyAttributes.vibroFactor, 6);
2508
2577
  // Scale the tap value with three-fingered penalty.
2509
2578
  tapValue /= this._tapPenalty;
2510
2579
  // OD 8 SS stays the same.
@@ -2762,32 +2831,6 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
2762
2831
  }
2763
2832
  return Number.POSITIVE_INFINITY;
2764
2833
  }
2765
- /**
2766
- * Calculates multiplier for tap to account for improper tapping based on the deviation and tap difficulty.
2767
- *
2768
- * https://www.desmos.com/calculator/dmogdhzofn
2769
- */
2770
- calculateTapHighDeviationNerf() {
2771
- if (this.tapDeviation === Number.POSITIVE_INFINITY) {
2772
- return 0;
2773
- }
2774
- const tapValue = this.baseValue(this.difficultyAttributes.tapDifficulty);
2775
- // Decide a point where the PP value achieved compared to the tap deviation is assumed to be
2776
- // tapped improperly. Any PP above this point is considered "excess" tap difficulty.
2777
- // This is used to cause PP above the cutoff to scale logarithmically towards the original
2778
- // tap value, thus nerfing the value.
2779
- const excessTapDifficultyCutoff = 100 + 220 * Math.pow(22 / this.tapDeviation, 6.5);
2780
- if (tapValue <= excessTapDifficultyCutoff) {
2781
- return 1;
2782
- }
2783
- const scale = 50;
2784
- const adjustedTapValue = scale *
2785
- (Math.log((tapValue - excessTapDifficultyCutoff) / scale + 1) +
2786
- excessTapDifficultyCutoff / scale);
2787
- // 200 UR and less are considered tapped correctly to ensure that normal scores will be punished as little as possible
2788
- const lerp = 1 - osuBase.MathUtils.clamp((this.tapDeviation - 20) / (24 - 20), 0, 1);
2789
- return osuBase.Interpolation.lerp(adjustedTapValue, tapValue, lerp) / tapValue;
2790
- }
2791
2834
  getConvertedHitWindow() {
2792
2835
  const hitWindow300 = new osuBase.OsuHitWindow(this.difficultyAttributes.overallDifficulty).greatWindow;
2793
2836
  if (this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModPrecise)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rian8337/osu-rebalance-difficulty-calculator",
3
- "version": "4.0.0-beta.45",
3
+ "version": "4.0.0-beta.46",
4
4
  "description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
5
5
  "keywords": [
6
6
  "osu",
@@ -38,5 +38,5 @@
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "gitHead": "de7b995e670f1703fcd134209d16fbc1c6788eb9"
41
+ "gitHead": "efe2ba882932f2de27ec1228a4931385049d0fb6"
42
42
  }
@@ -735,6 +735,18 @@ interface DroidDifficultyAttributes extends DifficultyAttributes {
735
735
  * The amount of strains that are considered difficult with respect to the visual skill.
736
736
  */
737
737
  visualDifficultStrainCount: number;
738
+ /**
739
+ * The average delta time of speed objects.
740
+ */
741
+ averageSpeedDeltaTime: number;
742
+ /**
743
+ * Describes how much of tap difficulty is contributed by notes that are "vibroable".
744
+ *
745
+ * A value closer to 1 indicates most of tap difficulty is contributed by notes that are not "vibroable".
746
+ *
747
+ * A value closer to 0 indicates most of tap difficulty is contributed by notes that are "vibroable".
748
+ */
749
+ vibroFactor: number;
738
750
  }
739
751
 
740
752
  /**
@@ -882,6 +894,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
882
894
  * Called after tap skill calculation.
883
895
  *
884
896
  * @param tapSkillCheese The tap skill that considers cheesing.
897
+ * @param tapSkillVibro The tap skill that considers vibro.
885
898
  */
886
899
  private postCalculateTap;
887
900
  /**
@@ -1253,12 +1266,6 @@ declare class DroidPerformanceCalculator extends PerformanceCalculator<DroidDiff
1253
1266
  * This is fine though, since this method is only used to scale tap pp.
1254
1267
  */
1255
1268
  private calculateTapDeviation;
1256
- /**
1257
- * Calculates multiplier for tap to account for improper tapping based on the deviation and tap difficulty.
1258
- *
1259
- * https://www.desmos.com/calculator/dmogdhzofn
1260
- */
1261
- private calculateTapHighDeviationNerf;
1262
1269
  private getConvertedHitWindow;
1263
1270
  toString(): string;
1264
1271
  }
@@ -1308,11 +1315,21 @@ declare class DroidTap extends DroidSkill {
1308
1315
  private currentRhythmMultiplier;
1309
1316
  private readonly skillMultiplier;
1310
1317
  private readonly considerCheesability;
1311
- constructor(mods: Mod[], considerCheesability: boolean);
1318
+ private readonly strainTimeCap?;
1319
+ private readonly _objectDeltaTimes;
1320
+ /**
1321
+ * The delta time of hitobjects.
1322
+ */
1323
+ get objectDeltaTimes(): readonly number[];
1324
+ constructor(mods: Mod[], considerCheesability: boolean, strainTimeCap?: number);
1312
1325
  /**
1313
1326
  * The amount of notes that are relevant to the difficulty.
1314
1327
  */
1315
1328
  relevantNoteCount(): number;
1329
+ /**
1330
+ * The delta time relevant to the difficulty.
1331
+ */
1332
+ relevantDeltaTime(): number;
1316
1333
  protected strainValueAt(current: DroidDifficultyHitObject): number;
1317
1334
  protected calculateInitialStrain(time: number, current: DroidDifficultyHitObject): number;
1318
1335
  protected getObjectStrain(): number;
@@ -1339,13 +1356,15 @@ declare abstract class DroidTapEvaluator extends SpeedEvaluator {
1339
1356
  * Evaluates the difficulty of tapping the current object, based on:
1340
1357
  *
1341
1358
  * - time between pressing the previous and current object,
1359
+ * - distance between those objects,
1342
1360
  * - how easily they can be cheesed,
1343
1361
  * - and the strain time cap.
1344
1362
  *
1345
1363
  * @param current The current object.
1346
1364
  * @param considerCheesability Whether to consider cheesability.
1365
+ * @param strainTimeCap The strain time to cap the object's strain time to.
1347
1366
  */
1348
- static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean): number;
1367
+ static evaluateDifficultyOf(current: DroidDifficultyHitObject, considerCheesability: boolean, strainTimeCap?: number): number;
1349
1368
  }
1350
1369
 
1351
1370
  /**