Skip to content

Instantly share code, notes, and snippets.

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using BenchmarkDotNet.Attributes;
namespace osu.Game.Benchmarks
{
public class BenchmarkStringComparison
{
@bdach
bdach / conversion-algorithm.md
Last active January 5, 2024 21:21
Extended documentation for osu!catch score conversion changes

Description of approximate conversion algorithm from score V1 to new standardised (score V2)

Rationale

The combo portions of stable's score V1 and score V2 differ in rate of progression. While score V1's combo portion is quadratic in progression in relation to current combo, score V2 is initially logarithmic until 200 combo, after which it is linear. This was demonstrated in prior work in #24823 and #24924, and is apparent on the screenshot below taken from catch's TestSceneScoring:

shapes

Notably, catch is the only ruleset wherein the rate of ascent differs between score V1 and score V2. This means, that for all other rulesets, it was completely fine to estimate the combo portion of score V2 / "standardised" scoring by just taking the linear ratio of combo score achieved on the beatmap to maximum combo score achievable on the beatmap.

@bdach
bdach / score-import-fail.md
Last active January 4, 2024 16:45
Debugging score import failures when running score spreadsheet via `diffcalc-sheet-generator`

Debugging score import failures when running score spreadsheet via diffcalc-sheet-generator

This guide is intended to tell you what to do when you see one of these:

diffcalc-sheet-generator-importer-1   | System.AggregateException: One or more errors occurred. (Processing legacy score 157224218 failed. (Total score conversion operation returned invalid total of -2344))
diffcalc-sheet-generator-importer-1   |  ---> System.AggregateException: Processing legacy score 157224218 failed. (Total score conversion operation returned invalid total of -2344)
diffcalc-sheet-generator-importer-1   |  ---> System.InvalidOperationException: Total score conversion operation returned invalid total of -2344
diffcalc-sheet-generator-importer-1   |    at osu.Game.Database.StandardisedScoreMigrationTools.convertFromLegacyTotalScore(ScoreInfo score, LegacyBeatmapConversionDifficultyInfo difficulty, LegacyScoreAttributes attributes) in /tmp/tmp.tBMkcXfjq4/osu/osu.Game/Database/StandardisedScoreMigrationTools.cs:line 298
d
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bdach
bdach / 01-patch-to-apply-onto-24779.diff
Created September 25, 2023 16:46
Classic scoring formula fit: The sources
commit 3782bbe084cfc4acb7e7cdac0b190188444de905
Author: Bartłomiej Dach <dach.bartlomiej@gmail.com>
Date: Wed Sep 20 21:39:42 2023 +0200
Output bonus score to attributes
diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
index 0183d723b2..f36371a53b 100644
--- a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
+++ b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyScoreSimulator.cs
@bdach
bdach / post-2019.1011.0.xml
Created December 7, 2019 19:45
Application manifest contents in osu!.exe
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity version="1.0.0.0" name="osu!" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<defaultAssemblyRequest permissionSetReference="Custom" />
@bdach
bdach / EasingBenchmark.cs
Created November 25, 2019 21:26
Easing curve benchmark (ppy/osu-framework#3026)
using System.Linq;
using BenchmarkDotNet.Attributes;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
namespace osu.Framework.Tests
{
public class EasingBenchmark
{
[Params(Easing.InExpo, Easing.InElastic, Easing.OutElasticHalf, Easing.OutElasticQuarter, Easing.InOutElastic)]
@bdach
bdach / onclick-event-refactoring.md
Last active September 5, 2019 22:28
OnClick event refactoring

OnClick event refactoring

Intended to resolve #5916.

Steps necessary for completion:

  • Change EnableClick to true in OsuUserInputManager.RightMouseManager
  • Review all OnClick() usages, add guard clauses wherever necessary
  • Review all case ClickEvent usages, add guard clauses wherever necessary
  • Review all OnMouseUp() usages, replace workarounds for right clicks with OnClick() handling