Skip to content

Commit

Permalink
added settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Givikap120 committed Sep 24, 2024
1 parent fd2dd09 commit a7673ee
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 21 deletions.
12 changes: 12 additions & 0 deletions osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ public class OsuDifficultyCalculator : DifficultyCalculator

public override int Version => 20231104;

// CONFIG
// default pp+ is all values are set to false

// Fix category
public const bool ENABLE_FIRST_SPEED_NOTE_FIX = true;
public const bool ENABLE_LAZER_SUPPORT = true; // Slideracc and no misscount estimation on lazer scores if Effective Miss Count enabled
public const bool ENABLE_EFFECTIVE_MISS_COUNT = true; // warning - always set this to true when using CSR
public const bool DISABLE_300BPM_SPEED_LIMIT = true;

// Balance category
public const bool ENABLE_CSR = true; // Combo Scaling Removal

public OsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
Expand Down
27 changes: 13 additions & 14 deletions osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ public OsuPerformanceCalculator()
{
}

private const bool enable_csr = true;

protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo score, DifficultyAttributes attributes)
{
Mod[] mods = score.Mods;
Expand Down Expand Up @@ -49,11 +47,11 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s

int accuracyHitObjectsCount = osuAttributes.HitCircleCount;

if (score.Mods.OfType<OsuModClassic>().All(m => !m.NoSliderHeadAccuracy.Value))
if (OsuDifficultyCalculator.ENABLE_LAZER_SUPPORT && score.Mods.OfType<OsuModClassic>().All(m => !m.NoSliderHeadAccuracy.Value))
{
accuracyHitObjectsCount += osuAttributes.SliderCount;
}
else if (enable_csr)
else if (OsuDifficultyCalculator.ENABLE_EFFECTIVE_MISS_COUNT)
{
effectiveMissCount = Math.Max(countMiss, calculateEffectiveMissCount(osuAttributes, scoreMaxCombo, countMiss, totalHits - countGreat));
}
Expand All @@ -64,12 +62,13 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s
double speedWeight = calculateSpeedWeight(normalisedHitError, scoreMaxCombo, osuAttributes.MaxCombo);
double accuracyWeight = calculateAccuracyWeight(accuracyHitObjectsCount, visualMods);

double aimValue = aimWeight * calculateSkillValue(osuAttributes.AimDifficulty) * calculateMissWeight(countMiss, osuAttributes.AimDifficultyStrainsCount);
double jumpAimValue = aimWeight * calculateSkillValue(osuAttributes.JumpAimDifficulty) * calculateMissWeight(countMiss, osuAttributes.JumpAimDifficultyStrainsCount);
double flowAimValue = aimWeight * calculateSkillValue(osuAttributes.FlowAimDifficulty) * calculateMissWeight(countMiss, osuAttributes.FlowAimDifficultyStrainsCount);
double precisionValue = aimWeight * calculateSkillValue(osuAttributes.PrecisionDifficulty) * calculateMissWeight(countMiss, osuAttributes.AimDifficultyStrainsCount);
double speedValue = speedWeight * calculateSkillValue(osuAttributes.SpeedDifficulty) * calculateMissWeight(countMiss, osuAttributes.SpeedDifficultyStrainsCount);
double staminaValue = speedWeight * calculateSkillValue(osuAttributes.StaminaDifficulty) * calculateMissWeight(countMiss, osuAttributes.StaminaDifficultyStrainsCount);
double aimValue = aimWeight * CalculateSkillValue(osuAttributes.AimDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.AimDifficultyStrainsCount);
double jumpAimValue = aimWeight * CalculateSkillValue(osuAttributes.JumpAimDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.JumpAimDifficultyStrainsCount);
double flowAimValue = aimWeight * CalculateSkillValue(osuAttributes.FlowAimDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.FlowAimDifficultyStrainsCount);
double precisionValue = aimWeight * CalculateSkillValue(osuAttributes.PrecisionDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.AimDifficultyStrainsCount);

double speedValue = speedWeight * CalculateSkillValue(osuAttributes.SpeedDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.SpeedDifficultyStrainsCount);
double staminaValue = speedWeight * CalculateSkillValue(osuAttributes.StaminaDifficulty) * calculateMissWeight(effectiveMissCount, osuAttributes.StaminaDifficultyStrainsCount);

double accuracyValue = calculateAccuracyValue(normalisedHitError) * osuAttributes.AccuracyDifficulty * accuracyWeight;

Expand All @@ -95,7 +94,7 @@ protected override PerformanceAttributes CreatePerformanceAttributes(ScoreInfo s
return result;
}

private static double calculateSkillValue(double skillDiff) => Math.Pow(skillDiff, 3) * 3.9;
public static double CalculateSkillValue(double skillDiff) => Math.Pow(skillDiff, 3) * 3.9;

private static double calculateNormalisedHitError(double od, int objectCount, int accuracyObjectCount, int count300)
{
Expand All @@ -113,23 +112,23 @@ private static double calculateNormalisedHitError(double od, int objectCount, in
return hitWindow / zValue; // Hit errors are normally distributed along the x-axis.
}

private static double calculateMissWeight(double misses, double difficultStrainCount) => enable_csr ? 0.96 / ((misses / (4 * Math.Pow(Math.Log(difficultStrainCount), 0.94))) + 1) : Math.Pow(0.97, misses);
private static double calculateMissWeight(double misses, double difficultStrainCount) => OsuDifficultyCalculator.ENABLE_CSR ? 0.96 / ((misses / (4 * Math.Pow(Math.Log(difficultStrainCount), 0.94))) + 1) : Math.Pow(0.97, misses);

private static double calculateAimWeight(double normalizedHitError, int combo, int maxCombo, int objectCount, Mod[] visualMods)
{
double accuracyWeight = Math.Pow(0.995, normalizedHitError) * 1.04;
double comboWeight = Math.Pow(combo, 0.8) / Math.Pow(maxCombo, 0.8);
double flashlightLengthWeight = visualMods.Any(m => m is OsuModFlashlight) ? 1 + comboWeight * Math.Atan(objectCount / 2000.0) : 1;

return accuracyWeight * (enable_csr ? 1 : comboWeight) * flashlightLengthWeight;
return accuracyWeight * (OsuDifficultyCalculator.ENABLE_CSR ? 1 : comboWeight) * flashlightLengthWeight;
}

private static double calculateSpeedWeight(double normalizedHitError, int combo, int maxCombo)
{
double accuracyWeight = Math.Pow(0.985, normalizedHitError) * 1.12;
double comboWeight = Math.Pow(combo, 0.4) / Math.Pow(maxCombo, 0.4);

return accuracyWeight * (enable_csr ? 1 : comboWeight);
return accuracyWeight * (OsuDifficultyCalculator.ENABLE_CSR ? 1 : comboWeight);
}

private static double calculateAccuracyWeight(int accuracyObjectCount, Mod[] visualMods)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class OsuDifficultyHitObject : DifficultyHitObject
/// </summary>
public const int NORMALISED_RADIUS = 52; // Change radius to 50 to make 100 the diameter. Easier for mental maths.

private const int min_delta_time = 50; // The DeltaTime cap shouldn't ever be on 50ms
private int minDeltaTime => OsuDifficultyCalculator.DISABLE_300BPM_SPEED_LIMIT ? 25 : 50;

protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject;

Expand Down Expand Up @@ -109,19 +109,19 @@ public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, Hit
Preempt = ((OsuHitObject)hitObject).TimePreempt / clockRate;

// Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure
StrainTime = Math.Max(min_delta_time, DeltaTime);
StrainTime = Math.Max(minDeltaTime, DeltaTime);

if (lastLastObject == null)
LastTwoStrainTime = min_delta_time * 2; // this is very wrong, use double.PositiveInfinity here
LastTwoStrainTime = OsuDifficultyCalculator.ENABLE_FIRST_SPEED_NOTE_FIX ? double.PositiveInfinity : 100;
else
LastTwoStrainTime = Math.Max(min_delta_time * 2, (hitObject.StartTime - lastLastObject.StartTime) / clockRate);
LastTwoStrainTime = Math.Max(minDeltaTime * 2, (hitObject.StartTime - lastLastObject.StartTime) / clockRate);

if (lastObject is HitCircle)
GapTime = StrainTime;
else if (lastObject is Slider lastSlider)
GapTime = Math.Max(min_delta_time, (hitObject.StartTime - lastSlider.EndTime) / clockRate);
GapTime = Math.Max(minDeltaTime, (hitObject.StartTime - lastSlider.EndTime) / clockRate);
else if (lastObject is Spinner lastSpinner)
GapTime = Math.Max(min_delta_time, (hitObject.StartTime - lastSpinner.EndTime) / clockRate);
GapTime = Math.Max(minDeltaTime, (hitObject.StartTime - lastSpinner.EndTime) / clockRate);

setFlowValues();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class RhythmComplexity : Skill

public RhythmComplexity(Mod[] mods) : base(mods)
{
isSliderAcc = mods.OfType<OsuModClassic>().All(m => !m.NoSliderHeadAccuracy.Value);
isSliderAcc = OsuDifficultyCalculator.ENABLE_LAZER_SUPPORT && mods.OfType<OsuModClassic>().All(m => !m.NoSliderHeadAccuracy.Value);
}

public override void Process(DifficultyHitObject current)
Expand Down

0 comments on commit a7673ee

Please sign in to comment.