1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Per encoding evaluation

This commit is contained in:
vun 2022-07-01 14:27:23 +08:00
parent cba47f8202
commit 5f8d21f33d
4 changed files with 68 additions and 22 deletions

View File

@ -12,17 +12,33 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Evaluators
return Math.Tanh(Math.E * -(val - center) / width);
}
public static double EvaluateDifficultyOf(ColourEncoding encoding)
{
return 1 / Math.Pow(encoding.MonoRunLength, 0.5);
}
public static double EvaluateDifficultyOf(CoupledColourEncoding coupledEncoding)
{
double difficulty = 0;
for (int i = 0; i < coupledEncoding.Payload.Length; i++)
{
difficulty += EvaluateDifficultyOf(coupledEncoding.Payload[i]);
}
return difficulty;
}
public static double EvaluateDifficultyOf(TaikoDifficultyHitObjectColour? colour)
{
if (colour == null) return 0;
double difficulty = 7.5 * Math.Log(colour.Encoding.Payload.Length + 1, 10);
// double difficulty = 9.5 * Math.Log(colour.Encoding.Payload.Length + 1, 10);
double difficulty = 3 * EvaluateDifficultyOf(colour.Encoding);
// foreach (ColourEncoding encoding in colour.Encoding.Payload)
// {
// difficulty += sigmoid(encoding.MonoRunLength, 1, 1) * 0.4 + 0.6;
// }
difficulty *= -sigmoid(colour.RepetitionInterval, 1, 7);
// difficulty *= -sigmoid(colour.RepetitionInterval, 2, 2) * 0.5 + 0.5;
// difficulty *= -sigmoid(colour.RepetitionInterval, 1, 7);
difficulty *= -sigmoid(colour.RepetitionInterval, 6, 5) * 0.5 + 0.5;
return difficulty;
}

View File

@ -35,22 +35,31 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
protected override double StrainValueOf(DifficultyHitObject current)
{
double difficulty = ColourEvaluator.EvaluateDifficultyOf(current);
// difficulty *= speedBonus(current.DeltaTime);
// TaikoDifficultyHitObject? taikoCurrent = (TaikoDifficultyHitObject)current;
// TaikoDifficultyHitObjectColour? colour = taikoCurrent?.Colour;
// if (taikoCurrent != null && colour != null)
// {
// ColourEncoding[] payload = colour.Encoding.Payload;
// string payloadDisplay = "";
// for (int i = 0; i < payload.Length; ++i)
// {
// payloadDisplay += $",({payload[i].MonoRunLength}|{payload[i].EncodingRunLength})";
// }
// System.Console.WriteLine($"{current.StartTime},{difficulty},{colour.RepetitionInterval},{colour.Encoding.RunLength}{payloadDisplay}");
// }
return difficulty;
}
// TODO: Remove befor pr
public string GetDebugString(DifficultyHitObject current)
{
double difficulty = ColourEvaluator.EvaluateDifficultyOf(current);
difficulty *= speedBonus(current.DeltaTime);
TaikoDifficultyHitObject? taikoCurrent = (TaikoDifficultyHitObject)current;
TaikoDifficultyHitObjectColour? colour = taikoCurrent?.Colour;
if (taikoCurrent != null && colour != null)
{
ColourEncoding[] payload = colour.Encoding.Payload;
string payloadDisplay = "";
for (int i = 0; i < payload.Length; ++i)
{
payloadDisplay += $"({payload[i].MonoRunLength}|{payload[i].EncodingRunLength})";
}
return $"{current.StartTime},{difficulty},{CurrentStrain},{colour.RepetitionInterval},{colour.Encoding.RunLength},{payloadDisplay}";
}
else
{
return $"{current.StartTime},{difficulty},{CurrentStrain},0,0,0";
}
}
}
}

View File

@ -1,17 +1,19 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Beatmaps;
namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
{
public class Peaks : Skill
{
private const double rhythm_skill_multiplier = 0.3 * final_multiplier;
private const double colour_skill_multiplier = 0.39 * final_multiplier;
private const double stamina_skill_multiplier = 0.33 * final_multiplier;
private const double colour_skill_multiplier = 0.375 * final_multiplier;
private const double stamina_skill_multiplier = 0.375 * final_multiplier;
private const double final_multiplier = 0.06;
@ -23,12 +25,25 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
public double RhythmDifficultyValue => rhythm.DifficultyValue() * rhythm_skill_multiplier;
public double StaminaDifficultyValue => stamina.DifficultyValue() * stamina_skill_multiplier;
public Peaks(Mod[] mods)
// TODO: remove before pr
private StreamWriter? colourDebugOutput;
bool debugColour = false;
public Peaks(Mod[] mods, IBeatmap beatmap)
: base(mods)
{
rhythm = new Rhythm(mods);
colour = new Colour(mods);
stamina = new Stamina(mods);
if (debugColour)
{
String filename = $"{beatmap.BeatmapInfo.Metadata.Title}[{beatmap.BeatmapInfo.DifficultyName}].csv";
filename = filename.Replace('/', '_');
colourDebugOutput = new StreamWriter(File.OpenWrite($"/run/mount/secondary/workspace/osu/output/colour-debug/{filename}"));
colourDebugOutput.WriteLine("StartTime,Raw,Decayed,RepetitionInterval,EncodingRunLength,Payload");
}
}
/// <summary>
@ -43,6 +58,12 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills
rhythm.Process(current);
colour.Process(current);
stamina.Process(current);
if (debugColour && colourDebugOutput != null)
{
colourDebugOutput.WriteLine(colour.GetDebugString(current));
colourDebugOutput.Flush();
}
}
/// <summary>

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
{
return new Skill[]
{
new Peaks(mods)
new Peaks(mods, beatmap)
};
}