source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

[TF2] Add thousands separators to various values

Open horiuchii opened this issue 8 months ago • 2 comments

Description

This PR adds thousands separators to various values across the game that tend to become very large and difficult to read at first glance without separators, this previously only existed on the player list stats on the MvM scoreboard.

I moved and renamed ConvertScoreboardValueToString inside of tf_hud_mann_vs_machine_scoreboard.cpp to V_AddThousandSeparators inside of strtools.cpp to make it a more accessible function, this was to avoid using V_pretifynum as it's around 4x slower and results in the same desired output.

The thousands separator applies to the following values:

  • Strange item counts
  • All stats displayed on scoreboards
  • PVP Panel stats (Casual XP, Comp MMR and unused MYM matchmaking stats)
  • Competitive match history stats
  • MvM Currency (Counts near the player health and the upgrade menu and upgrade cost)

Examples:

horiuchii avatar Jun 03 '25 21:06 horiuchii

Sounds great but it might be good to add some way to localize this since certain languages use . as the thousands seperator and , as the decimal seperator

gidi30 avatar Jun 03 '25 21:06 gidi30

Sounds great but it might be good to add some way to localize this since certain languages use . as the thousands seperator and , as the decimal seperator

In Spanish both for Latin America and Spain, four-digit numbers do not use a period or comma as a separator. For five digits or more, a space is used as the thousands separator (ideally a non-breaking space).

So, if this pull request were to be implemented, the values should be implemented as localized strings with format variables, so localizers can properly apply the correct number formatting for their language (like Deadlock). image

gaelcoral avatar Jun 03 '25 22:06 gaelcoral