Skip to content

Add ranked play division badges - #38989

Merged
smoogipoo merged 7 commits into
ppy:masterfrom
LiquidPL:rp-division-badge
Nov 3, 2026
Merged

smoogipoo merged 7 commits into
ppy:masterfrom
LiquidPL:rp-division-badge

Conversation

@LiquidPL

@LiquidPL LiquidPL commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Requires ppy/osu-resources#440.

This PR adds components rendering both the full and compact variants of the badge displaying the user's division inside of ranked play.

Also includes a proposed DTO for storing division metadata, which I hope will later be used when we get web to serve tier/division data to the client. I prefered doing this over implicitly assuming divisions start at 600, are spaced 100 ELO apart, etc. since the intention is to have this metadata served by web anyway.

Regular badges:

image

Compact badges:

image

Requires ppy/osu-resources#440.

This PR adds components rendering both the full and compact variants of
the badge displaying the user's division inside of ranked play.

Also includes a proposed DTO for storing division metadata, which I hope
will later be used when we get web to serve tier/division data to the
client. I prefered doing this over implicitly assuming divisions start
at 600, are spaced 100 ELO apart, etc. since the intention is to have
this metadata served by web anyway.
}

[JsonConverter(typeof(StringEnumConverter))]
public enum Tier

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would not put these in the same file as RankedPlayDivision. Maybe RankedPlayTier/RankedPlayDivision so that they're distinct from RankingTier (if we even want this to be separate in the first place).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I completely missed RankingTier existing, will use that for now. Also will split out the division enum to a separate file and rename the model to APIRankedPlayDivision or something like that (is there a reason some response models have the API prefix and some don't?).

Comment on lines +58 to +84
new Sprite
{
Size = division.Tier switch
{
Tier.Bronze => new Vector2(33),
Tier.Silver => new Vector2(34.5f),
_ => new Vector2(36),
},
Position = division.Tier switch
{
Tier.Bronze => new Vector2(43.5f, 24.75f),
Tier.Silver => new Vector2(42.75f, 27),
Tier.Gold => new Vector2(42, 23.25f),
Tier.Platinum => new Vector2(42, 28.5f),
Tier.Rhodium => new Vector2(42, 30),
Tier.Radiant => new Vector2(42, 33),
Tier.Lustrous => new Vector2(42, 43.5f),
_ => throw new ArgumentOutOfRangeException()
},
Texture = textures.Get($@"Online/RankedPlay/Tiers/Rulesets/{ruleset.ShortName}"),
},
new Sprite
{
RelativeSizeAxes = Axes.Both,
Texture = textures.Get($@"Online/RankedPlay/Tiers/Stars/{division.Key}"),
FillMode = FillMode.Fit,
},

@minetoblend minetoblend Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

the shine layer will go above the stars but below the ruleset icon, so probably a good idea to swap the draw order these two

Comment on lines +13 to +14
[JsonProperty(@"key")]
public string Key = string.Empty;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this actually useful? Isn't it basically a concatenation of Tier and Division?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I've split this out into a explicitly defined property since Lustrous doesn't have a division, and I wanted to avoid any ambiguity where some piece of code somewhere would forget to not concat anything to the end of Lustrous, causing bugs.

I can replace this with something like

public string Key => Tier == RankingTier.Lustrous
    ? Tier.ToString()
    : $"{Tier}-{Division}";

considering we're probably not changing the Lustrous name anytime soon.

(the same could probably go for DisplayName as well)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I definitely prefer that to reduce the chance to make mistakes.

[JsonProperty(@"start_rating")]
public int StartRating;

[JsonProperty("@end_rating")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
[JsonProperty("@end_rating")]
[JsonProperty(@"end_rating")]

@smoogipoo
smoogipoo merged commit 382c3bf into ppy:master Nov 3, 2026
10 checks passed
@LiquidPL
LiquidPL deleted the rp-division-badge branch November 3, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants