@rian8337/osu-rebalance-difficulty-calculator 4.0.0-beta.22 → 4.0.0-beta.24
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 +102 -30
- package/package.json +3 -3
- package/typings/index.d.ts +17 -0
package/dist/index.js
CHANGED
|
@@ -568,6 +568,14 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
568
568
|
// Reward sliders based on velocity.
|
|
569
569
|
sliderBonus = last.travelDistance / last.travelTime;
|
|
570
570
|
}
|
|
571
|
+
// Reduce snap aim difficulty for low spacing as the player is more likely to perform
|
|
572
|
+
// a flowing movement instead of snapping to the object. This also prevents the weird
|
|
573
|
+
// scenario of awarding flow aim difficulty in snap aim.
|
|
574
|
+
const flowBonus = Math.pow(last.minimumJumpDistance / this.singleSpacingThreshold, 3.5);
|
|
575
|
+
if (flowBonus < 1) {
|
|
576
|
+
strain *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
577
|
+
wideAngleBonus *= 0.5 * (1 + Math.sqrt(flowBonus));
|
|
578
|
+
}
|
|
571
579
|
// Add in acute angle bonus or wide angle bonus + velocity change bonus, whichever is larger.
|
|
572
580
|
strain += Math.max(acuteAngleBonus * this.acuteAngleMultiplier, wideAngleBonus * this.wideAngleMultiplier +
|
|
573
581
|
velocityChangeBonus * this.velocityChangeMultiplier);
|
|
@@ -582,16 +590,32 @@ class DroidAimEvaluator extends AimEvaluator {
|
|
|
582
590
|
* Calculates the flow aim strain of a hitobject.
|
|
583
591
|
*/
|
|
584
592
|
static flowAimStrainOf(current) {
|
|
585
|
-
var _a
|
|
593
|
+
var _a;
|
|
586
594
|
let speedBonus = 1;
|
|
587
595
|
if (current.strainTime < this.minSpeedBonus) {
|
|
588
596
|
speedBonus +=
|
|
589
597
|
0.75 *
|
|
590
598
|
Math.pow((this.minSpeedBonus - current.strainTime) / 40, 2);
|
|
591
599
|
}
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
600
|
+
const prev = current.previous(0);
|
|
601
|
+
// Punish low spacing as it is easier to aim.
|
|
602
|
+
const travelDistance = (_a = prev === null || prev === void 0 ? void 0 : prev.travelDistance) !== null && _a !== void 0 ? _a : 0;
|
|
603
|
+
const distance = travelDistance + current.minimumJumpDistance;
|
|
604
|
+
const shortDistancePenalty = Math.min(1, Math.pow(distance / this.singleSpacingThreshold, 3.5));
|
|
605
|
+
let adjustedDistanceScale = 1;
|
|
606
|
+
// Reward for inconsistent angles while punishing consistent ones.
|
|
607
|
+
// Graph: https://www.desmos.com/calculator/soomupyfwp
|
|
608
|
+
if (current.angle !== null &&
|
|
609
|
+
typeof (prev === null || prev === void 0 ? void 0 : prev.angle) === "number" &&
|
|
610
|
+
current.angle !== prev.angle) {
|
|
611
|
+
const angleDiff = Math.abs(current.angle - prev.angle);
|
|
612
|
+
const adjustedAngleDiff = Math.sin(angleDiff / 2) * 180;
|
|
613
|
+
const angularVelocity = adjustedAngleDiff / (0.1 + current.strainTime);
|
|
614
|
+
const angularVelocityBonus = Math.max(0, Math.pow(angularVelocity, 0.4) - 1);
|
|
615
|
+
adjustedDistanceScale = 0.65 + angularVelocityBonus * 0.45;
|
|
616
|
+
}
|
|
617
|
+
return ((200 * speedBonus * shortDistancePenalty * adjustedDistanceScale) /
|
|
618
|
+
current.strainTime);
|
|
595
619
|
}
|
|
596
620
|
}
|
|
597
621
|
DroidAimEvaluator.wideAngleMultiplier = 1.65;
|
|
@@ -689,7 +713,12 @@ class StrainSkill extends Skill {
|
|
|
689
713
|
class DroidSkill extends StrainSkill {
|
|
690
714
|
constructor() {
|
|
691
715
|
super(...arguments);
|
|
716
|
+
/**
|
|
717
|
+
* The minimum number of strains to judge when computing for retryability.
|
|
718
|
+
*/
|
|
719
|
+
this.minimumRetryabilityStrains = 500;
|
|
692
720
|
this._objectStrains = [];
|
|
721
|
+
this.difficulty = 0;
|
|
693
722
|
}
|
|
694
723
|
/**
|
|
695
724
|
* The strains of hitobjects.
|
|
@@ -703,6 +732,25 @@ class DroidSkill extends StrainSkill {
|
|
|
703
732
|
* The result is scaled by clock rate as it affects the total number of strains.
|
|
704
733
|
*/
|
|
705
734
|
countDifficultStrains() {
|
|
735
|
+
if (this.difficulty === 0) {
|
|
736
|
+
return 0;
|
|
737
|
+
}
|
|
738
|
+
// This is what the top strain is if all strain values were identical.
|
|
739
|
+
const consistentTopStrain = this.difficulty / 10;
|
|
740
|
+
// Use a weighted sum of all strains.
|
|
741
|
+
return this._objectStrains.reduce((total, next) => total +
|
|
742
|
+
1.1 / (1 + Math.exp(-10 * (next / consistentTopStrain - 0.88))), 0);
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
746
|
+
*
|
|
747
|
+
* Earlier difficult strains indicate higher retryability.
|
|
748
|
+
*
|
|
749
|
+
* The result is scaled by clock rate as it affects the total number of strains.
|
|
750
|
+
*
|
|
751
|
+
* @returns A number between 0 and 1. A higher value indicates higher retryability.
|
|
752
|
+
*/
|
|
753
|
+
countRetryability() {
|
|
706
754
|
if (this._objectStrains.length === 0) {
|
|
707
755
|
return 0;
|
|
708
756
|
}
|
|
@@ -710,7 +758,16 @@ class DroidSkill extends StrainSkill {
|
|
|
710
758
|
if (maxStrain === 0) {
|
|
711
759
|
return 0;
|
|
712
760
|
}
|
|
713
|
-
|
|
761
|
+
let weightedStrainSum = 0;
|
|
762
|
+
for (let i = 0; i < this._objectStrains.length; ++i) {
|
|
763
|
+
const strainRatio = this._objectStrains[i] / maxStrain;
|
|
764
|
+
// Give more weight to earlier strains.
|
|
765
|
+
const strainPositionWeight = 1 - Math.pow(i / this._objectStrains.length, 0.75) / 10;
|
|
766
|
+
weightedStrainSum += strainRatio * strainPositionWeight;
|
|
767
|
+
}
|
|
768
|
+
return (1 -
|
|
769
|
+
weightedStrainSum /
|
|
770
|
+
Math.max(this._objectStrains.length, this.minimumRetryabilityStrains));
|
|
714
771
|
}
|
|
715
772
|
process(current) {
|
|
716
773
|
super.process(current);
|
|
@@ -728,12 +785,12 @@ class DroidSkill extends StrainSkill {
|
|
|
728
785
|
}
|
|
729
786
|
// Math here preserves the property that two notes of equal difficulty x, we have their summed difficulty = x * starsPerDouble.
|
|
730
787
|
// This also applies to two sets of notes with equal difficulty.
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
788
|
+
this.difficulty = 0;
|
|
789
|
+
for (const strain of strains) {
|
|
790
|
+
this.difficulty += Math.pow(strain, 1 / Math.log2(this.starsPerDouble));
|
|
791
|
+
}
|
|
792
|
+
this.difficulty = Math.pow(this.difficulty, Math.log2(this.starsPerDouble));
|
|
793
|
+
return this.difficulty;
|
|
737
794
|
}
|
|
738
795
|
calculateCurrentSectionStart(current) {
|
|
739
796
|
return current.startTime;
|
|
@@ -860,6 +917,7 @@ class DroidTap extends DroidSkill {
|
|
|
860
917
|
this.reducedSectionBaseline = 0.75;
|
|
861
918
|
this.strainDecayBase = 0.3;
|
|
862
919
|
this.starsPerDouble = 1.1;
|
|
920
|
+
this.minimumRetryabilityStrains = 750;
|
|
863
921
|
this.currentTapStrain = 0;
|
|
864
922
|
this.currentRhythmMultiplier = 0;
|
|
865
923
|
this.skillMultiplier = 1375;
|
|
@@ -1316,11 +1374,12 @@ class DroidVisualEvaluator {
|
|
|
1316
1374
|
// Invert the scaling factor to determine the true travel distance independent of circle size.
|
|
1317
1375
|
const pixelTravelDistance = current.object.lazyTravelDistance / scalingFactor;
|
|
1318
1376
|
const currentVelocity = pixelTravelDistance / current.travelTime;
|
|
1377
|
+
const spanTravelDistance = pixelTravelDistance / current.object.spanCount;
|
|
1319
1378
|
strain +=
|
|
1320
1379
|
// Reward sliders based on velocity, while also avoiding overbuffing extremely fast sliders.
|
|
1321
1380
|
Math.min(6, currentVelocity * 1.5) *
|
|
1322
1381
|
// Longer sliders require more reading.
|
|
1323
|
-
(
|
|
1382
|
+
(spanTravelDistance / 100);
|
|
1324
1383
|
let cumulativeStrainTime = 0;
|
|
1325
1384
|
// Reward for velocity changes based on last few sliders.
|
|
1326
1385
|
for (let i = 0; i < Math.min(current.index, 4); ++i) {
|
|
@@ -1332,14 +1391,15 @@ class DroidVisualEvaluator {
|
|
|
1332
1391
|
continue;
|
|
1333
1392
|
}
|
|
1334
1393
|
// Invert the scaling factor to determine the true travel distance independent of circle size.
|
|
1335
|
-
const
|
|
1336
|
-
const lastVelocity =
|
|
1394
|
+
const lastPixelTravelDistance = last.object.lazyTravelDistance / scalingFactor;
|
|
1395
|
+
const lastVelocity = lastPixelTravelDistance / last.travelTime;
|
|
1396
|
+
const lastSpanTravelDistance = lastPixelTravelDistance / last.object.spanCount;
|
|
1337
1397
|
strain +=
|
|
1338
1398
|
// Reward past sliders based on velocity changes, while also
|
|
1339
1399
|
// avoiding overbuffing extremely fast velocity changes.
|
|
1340
1400
|
Math.min(10, 2.5 * Math.abs(currentVelocity - lastVelocity)) *
|
|
1341
1401
|
// Longer sliders require more reading.
|
|
1342
|
-
(
|
|
1402
|
+
(lastSpanTravelDistance / 125) *
|
|
1343
1403
|
// Avoid overbuffing past sliders.
|
|
1344
1404
|
Math.min(1, 300 / cumulativeStrainTime);
|
|
1345
1405
|
}
|
|
@@ -1815,10 +1875,13 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1815
1875
|
postCalculateAim(aimSkill, aimSkillWithoutSliders) {
|
|
1816
1876
|
this.strainPeaks.aimWithSliders = aimSkill.strainPeaks;
|
|
1817
1877
|
this.strainPeaks.aimWithoutSliders = aimSkillWithoutSliders.strainPeaks;
|
|
1818
|
-
|
|
1878
|
+
const retryabilityScaling = this.calculateRetryabilityScaling(aimSkill.countRetryability());
|
|
1879
|
+
this.attributes.aimDifficulty =
|
|
1880
|
+
this.starValue(aimSkill.difficultyValue()) * retryabilityScaling;
|
|
1819
1881
|
if (this.aim) {
|
|
1820
1882
|
this.attributes.sliderFactor =
|
|
1821
|
-
this.starValue(aimSkillWithoutSliders.difficultyValue())
|
|
1883
|
+
(this.starValue(aimSkillWithoutSliders.difficultyValue()) *
|
|
1884
|
+
retryabilityScaling) /
|
|
1822
1885
|
this.aim;
|
|
1823
1886
|
}
|
|
1824
1887
|
if (this.mods.some((m) => m instanceof osuBase.ModRelax)) {
|
|
@@ -1869,12 +1932,16 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1869
1932
|
*/
|
|
1870
1933
|
postCalculateTap(tapSkillCheese, tapSkillVibro) {
|
|
1871
1934
|
this.strainPeaks.speed = tapSkillCheese.strainPeaks;
|
|
1935
|
+
const retryabilityScaling = this.calculateRetryabilityScaling(tapSkillCheese.countRetryability());
|
|
1872
1936
|
this.attributes.tapDifficulty = this.mods.some((m) => m instanceof osuBase.ModRelax)
|
|
1873
1937
|
? 0
|
|
1874
|
-
: this.starValue(tapSkillCheese.difficultyValue())
|
|
1938
|
+
: this.starValue(tapSkillCheese.difficultyValue()) *
|
|
1939
|
+
retryabilityScaling;
|
|
1875
1940
|
if (this.tap) {
|
|
1876
1941
|
this.attributes.vibroFactor =
|
|
1877
|
-
this.starValue(tapSkillVibro.difficultyValue())
|
|
1942
|
+
(this.starValue(tapSkillVibro.difficultyValue()) *
|
|
1943
|
+
retryabilityScaling) /
|
|
1944
|
+
this.tap;
|
|
1878
1945
|
}
|
|
1879
1946
|
this.attributes.speedNoteCount = tapSkillCheese.relevantNoteCount();
|
|
1880
1947
|
this.attributes.averageSpeedDeltaTime =
|
|
@@ -1977,6 +2044,9 @@ class DroidDifficultyCalculator extends DifficultyCalculator {
|
|
|
1977
2044
|
this.attributes.visualDifficultStrainCount =
|
|
1978
2045
|
visualSkillWithSliders.countDifficultStrains();
|
|
1979
2046
|
}
|
|
2047
|
+
calculateRetryabilityScaling(retryability) {
|
|
2048
|
+
return 1 - Math.pow(retryability, 4) / 10;
|
|
2049
|
+
}
|
|
1980
2050
|
}
|
|
1981
2051
|
/**
|
|
1982
2052
|
* The strain threshold to start detecting for possible three-fingered section.
|
|
@@ -2355,8 +2425,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2355
2425
|
aimValue *= this._aimSliderCheesePenalty;
|
|
2356
2426
|
// Scale the aim value with deviation.
|
|
2357
2427
|
aimValue *=
|
|
2358
|
-
1.
|
|
2359
|
-
Math.
|
|
2428
|
+
1.025 *
|
|
2429
|
+
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.475);
|
|
2360
2430
|
// OD 7 SS stays the same.
|
|
2361
2431
|
aimValue *= 0.98 + Math.pow(7, 2) / 2500;
|
|
2362
2432
|
return aimValue;
|
|
@@ -2368,8 +2438,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2368
2438
|
let tapValue = this.baseValue(this.difficultyAttributes.tapDifficulty);
|
|
2369
2439
|
tapValue *= this.calculateStrainBasedMissPenalty(this.difficultyAttributes.tapDifficultStrainCount);
|
|
2370
2440
|
// Scale the tap value with estimated full combo deviation.
|
|
2371
|
-
//
|
|
2372
|
-
|
|
2441
|
+
// Consider notes that are difficult to tap with respect to other notes, but
|
|
2442
|
+
// also cap the note count to prevent buffing filler patterns.
|
|
2443
|
+
tapValue *= this.calculateDeviationBasedLengthScaling(Math.min(this.difficultyAttributes.speedNoteCount, this.totalHits / 1.45));
|
|
2373
2444
|
// Normalize the deviation to 300 BPM.
|
|
2374
2445
|
const normalizedDeviation = this.tapDeviation *
|
|
2375
2446
|
Math.max(1, 50 / this.difficultyAttributes.averageSpeedDeltaTime);
|
|
@@ -2384,8 +2455,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2384
2455
|
((2 * 300) / averageBPM))));
|
|
2385
2456
|
// Scale the tap value with tap deviation.
|
|
2386
2457
|
tapValue *=
|
|
2387
|
-
1.
|
|
2388
|
-
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.
|
|
2458
|
+
1.05 *
|
|
2459
|
+
Math.pow(osuBase.ErrorFunction.erf(20 / (Math.SQRT2 * adjustedDeviation)), 0.6);
|
|
2389
2460
|
// Additional scaling for tap value based on average BPM and how "vibroable" the beatmap is.
|
|
2390
2461
|
// Higher BPMs require more precise tapping. When the deviation is too high,
|
|
2391
2462
|
// it can be assumed that the player taps invariant to rhythm.
|
|
@@ -2410,7 +2481,7 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2410
2481
|
this.totalSuccessfulHits === 0) {
|
|
2411
2482
|
return 0;
|
|
2412
2483
|
}
|
|
2413
|
-
let accuracyValue =
|
|
2484
|
+
let accuracyValue = 650 * Math.exp(-0.1 * this._deviation);
|
|
2414
2485
|
const ncircles = this.difficultyAttributes.mods.some((m) => m instanceof osuBase.ModScoreV2)
|
|
2415
2486
|
? this.totalHits - this.difficultyAttributes.spinnerCount
|
|
2416
2487
|
: this.difficultyAttributes.hitCircleCount;
|
|
@@ -2463,8 +2534,8 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2463
2534
|
visualValue *= this._visualSliderCheesePenalty;
|
|
2464
2535
|
// Scale the visual value with deviation.
|
|
2465
2536
|
visualValue *=
|
|
2466
|
-
1.
|
|
2467
|
-
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.
|
|
2537
|
+
1.05 *
|
|
2538
|
+
Math.pow(osuBase.ErrorFunction.erf(25 / (Math.SQRT2 * this._deviation)), 0.775);
|
|
2468
2539
|
// OD 5 SS stays the same.
|
|
2469
2540
|
visualValue *= 0.98 + Math.pow(5, 2) / 2500;
|
|
2470
2541
|
return visualValue;
|
|
@@ -2480,8 +2551,9 @@ class DroidPerformanceCalculator extends PerformanceCalculator {
|
|
|
2480
2551
|
if (this.effectiveMissCount === 0) {
|
|
2481
2552
|
return 1;
|
|
2482
2553
|
}
|
|
2483
|
-
return (0.
|
|
2484
|
-
(this.effectiveMissCount /
|
|
2554
|
+
return (0.96 /
|
|
2555
|
+
(this.effectiveMissCount /
|
|
2556
|
+
(4 * Math.pow(Math.log(difficultStrainCount), 0.94)) +
|
|
2485
2557
|
1));
|
|
2486
2558
|
}
|
|
2487
2559
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.24",
|
|
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",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@rian8337/osu-base": "^4.0.0-beta.
|
|
36
|
+
"@rian8337/osu-base": "^4.0.0-beta.24"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "b567d54f6f8553aeaf56acb8a0b3741c3920b72b"
|
|
42
42
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -515,17 +515,32 @@ declare abstract class DroidSkill extends StrainSkill {
|
|
|
515
515
|
* The bonus multiplier that is given for a sequence of notes of equal difficulty.
|
|
516
516
|
*/
|
|
517
517
|
protected abstract readonly starsPerDouble: number;
|
|
518
|
+
/**
|
|
519
|
+
* The minimum number of strains to judge when computing for retryability.
|
|
520
|
+
*/
|
|
521
|
+
protected readonly minimumRetryabilityStrains: number;
|
|
518
522
|
protected readonly _objectStrains: number[];
|
|
519
523
|
/**
|
|
520
524
|
* The strains of hitobjects.
|
|
521
525
|
*/
|
|
522
526
|
get objectStrains(): readonly number[];
|
|
527
|
+
private difficulty;
|
|
523
528
|
/**
|
|
524
529
|
* Returns the number of strains weighed against the top strain.
|
|
525
530
|
*
|
|
526
531
|
* The result is scaled by clock rate as it affects the total number of strains.
|
|
527
532
|
*/
|
|
528
533
|
countDifficultStrains(): number;
|
|
534
|
+
/**
|
|
535
|
+
* Computes the retryability of the beatmap based on the strains of the hitobjects.
|
|
536
|
+
*
|
|
537
|
+
* Earlier difficult strains indicate higher retryability.
|
|
538
|
+
*
|
|
539
|
+
* The result is scaled by clock rate as it affects the total number of strains.
|
|
540
|
+
*
|
|
541
|
+
* @returns A number between 0 and 1. A higher value indicates higher retryability.
|
|
542
|
+
*/
|
|
543
|
+
countRetryability(): number;
|
|
529
544
|
process(current: DifficultyHitObject): void;
|
|
530
545
|
difficultyValue(): number;
|
|
531
546
|
/**
|
|
@@ -885,6 +900,7 @@ declare class DroidDifficultyCalculator extends DifficultyCalculator<DroidDiffic
|
|
|
885
900
|
* @param visualSkillWithoutSliders The visual skill that doesn't consider sliders.
|
|
886
901
|
*/
|
|
887
902
|
private postCalculateVisual;
|
|
903
|
+
private calculateRetryabilityScaling;
|
|
888
904
|
}
|
|
889
905
|
|
|
890
906
|
/**
|
|
@@ -1282,6 +1298,7 @@ declare class DroidTap extends DroidSkill {
|
|
|
1282
1298
|
protected readonly reducedSectionBaseline = 0.75;
|
|
1283
1299
|
protected readonly strainDecayBase = 0.3;
|
|
1284
1300
|
protected readonly starsPerDouble = 1.1;
|
|
1301
|
+
protected readonly minimumRetryabilityStrains = 750;
|
|
1285
1302
|
private currentTapStrain;
|
|
1286
1303
|
private currentRhythmMultiplier;
|
|
1287
1304
|
private readonly skillMultiplier;
|