Skip to content

Conversation

@stanriders
Copy link
Member

This also changes the bpm format to be consistent with the rest of the game. I would love for the SR display to show real values too, but that requires loading a full beatmap and the tournament client only has access to the metadata.

NM:
image

HR:
image

DT:
image

Mania NM:
image

Mania HR:
image

This is being queried by the https://github.com/ppy/osu/blob/master/osu.Game.Rulesets.Mania/ManiaRuleset.cs#L442 but since we don't actually draw column count anywhere nor are we supposed to be running converts in tournaments it should be safe to populate it with nothing.
@stanriders stanriders added type/cosmetic Only affects the game visually. Doesn't affect things working or not working. area:tournament labels Nov 21, 2025
@peppy
Copy link
Member

peppy commented Nov 22, 2025

Could probably download the .osu file to get full stats using the /osu/ endpoint?

@stanriders
Copy link
Member Author

Yea maybe, but that would require adding an .osu cache and predownload handling so I'd rather do it as a separate PR

string IBeatmapInfo.MD5Hash => throw new NotImplementedException();

IRulesetInfo IBeatmapInfo.Ruleset => throw new NotImplementedException();
IRulesetInfo IBeatmapInfo.Ruleset => new RulesetInfo();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this change for? I really don't like the look of it.

Copy link
Member Author

@stanriders stanriders Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image TournamentBeatmap by itself is pretty much just a metadata wrapper

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can

public class APIRuleset : IRulesetInfo
{
public int OnlineID { get; set; } = -1;
public string Name => $@"{nameof(APIRuleset)} (ID: {OnlineID})";
public string ShortName
{
get
{
// TODO: this should really not exist.
switch (OnlineID)
{
case 0: return "osu";
case 1: return "taiko";
case 2: return "fruits";
case 3: return "mania";
default: throw new ArgumentOutOfRangeException();
}
}
}
public string InstantiationInfo => string.Empty;
public Ruleset CreateInstance() => throw new NotImplementedException();
public bool Equals(IRulesetInfo? other) => other is APIRuleset r && this.MatchesOnlineID(r);
public int CompareTo(IRulesetInfo? other)
{
if (!(other is APIRuleset ruleset))
throw new ArgumentException($@"Object is not of type {nameof(APIRuleset)}.", nameof(other));
return OnlineID.CompareTo(ruleset.OnlineID);
}
// ReSharper disable once NonReadonlyMemberInGetHashCode
public override int GetHashCode() => OnlineID;
}
be used (copied out from APIBeatmap in ctor) instead at least?

I really don't like these sorts of model hacks because they have a tendency to produce nasty buggage later. At least I'd like to have things in vaguely the correct wheelhouse rather just a blank model instance...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're fine with it not being populated with anything and just always being OnlineID = -1 - sure

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why though, surely you could just

diff --git a/osu.Game.Tournament/Models/TournamentBeatmap.cs b/osu.Game.Tournament/Models/TournamentBeatmap.cs
index a7ba5b7db1..59003bc739 100644
--- a/osu.Game.Tournament/Models/TournamentBeatmap.cs
+++ b/osu.Game.Tournament/Models/TournamentBeatmap.cs
@@ -47,6 +47,7 @@ public TournamentBeatmap(APIBeatmap beatmap)
             Covers = beatmap.BeatmapSet?.Covers ?? new BeatmapSetOnlineCovers();
             EndTimeObjectCount = beatmap.EndTimeObjectCount;
             TotalObjectCount = beatmap.TotalObjectCount;
+            Ruleset = beatmap.Ruleset;
         }
 
         public bool Equals(IBeatmapInfo? other) => other is TournamentBeatmap b && this.MatchesOnlineID(b);

no? What am I missing here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beatmap gets created from IPC, I'm pretty sure it wouldn't have ruleset unless stable starts sending one

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not how any of that works. The "IPC" does an API request to look the beatmap up.

int beatmapId = int.Parse(sr.ReadLine().AsNonNull());
int mods = int.Parse(sr.ReadLine().AsNonNull());
if (lastBeatmapId != beatmapId)
{
beatmapLookupRequest?.Cancel();
lastBeatmapId = beatmapId;
var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId);
if (existing != null)
Beatmap.Value = existing.Beatmap;
else
{
beatmapLookupRequest = new GetBeatmapRequest(new APIBeatmap { OnlineID = beatmapId });
beatmapLookupRequest.Success += b =>
{
if (lastBeatmapId == beatmapId)
Beatmap.Value = new TournamentBeatmap(b);
};
beatmapLookupRequest.Failure += _ =>
{
if (lastBeatmapId == beatmapId)
Beatmap.Value = null;
};
API.Queue(beatmapLookupRequest);
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's...quite a structure. Should be simple then, I'll fix it now

bdach
bdach previously approved these changes Nov 24, 2025
This is dodgy as hell but `ShortName` is completely derived from
`OnlineID` anyway so there should be no valid reason to ever attempt to
serialise it anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tournament size/M type/cosmetic Only affects the game visually. Doesn't affect things working or not working.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants