ppy / osu-tools

command line tools to get stuff done
MIT License
105 stars 78 forks source link

Issue with JSON output #124

Closed matthieu-locussol closed 3 years ago

matthieu-locussol commented 3 years ago

I gave a try locally to the simulate tool and ran into a problem while simulating a play on a map (here named map.osu). The JSON output is incorrect because - I believe - some attributes get overriden by each other.

Here, take a look at the normal command WITHOUT --json flag:

dotnet run --project PerformanceCalculator.csproj --configuration Release -- simulate osu map.osu -m:HD -m:HR -G:5
xi - FREEDOM DiVE (Nakagawa-Kanon) [FOUR DIMENSIONS]
Accuracy       : 99.83190452176837%
Combo          : 2385 (100%)
Great          : 1978
Ok             : 5
Meh            : 0
Miss           : 0
Mods           : HD, HR
Aim            : 282.549316567955
Speed          : 382.89578323239095
Accuracy       : 222.7765006385657
Flashlight     : 0
OD             : 10
AR             : 10
Max Combo      : 2385
pp             : 902.472286786258

We can see that there are two Accuracy values, but as JSON requires key unicity, when I add the --json flag, the output becomes:

dotnet run --project PerformanceCalculator.csproj --configuration Release -- simulate osu map.osu -m:HD -m:HR -G:5 --json
{
  "Beatmap": "xi - FREEDOM DiVE (Nakagawa-Kanon) [FOUR DIMENSIONS]",
  "Accuracy": 222.7765006385657,
  "Combo": 2385.0,
  "Great": 1978.0,
  "Ok": 5.0,
  "Meh": 0.0,
  "Miss": 0.0,
  "Mods": "HD, HR",
  "Aim": 282.549316567955,
  "Speed": 382.89578323239095,
  "Flashlight": 0.0,
  "OD": 10.0,
  "AR": 10.0,
  "Max Combo": 2385.0,
  "pp": 902.472286786258
}

And I feel like the first key Accuracy (99.83190452176837%) got overriden by the second Accuracy key (222.7765006385657) which ends up in an absurd result that is > 100%.