[WIP] Write global achivements progress to JSON file #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements functionality to fetch and write global achievement unlock percentages from Steam's Web API to a file named
achievements.json.glb. This allows the emulator to display achievement rarity statistics and inform players about how common or rare their achievements are.Implementation Details
New Functionality
Added
get_global_achievement_percentages(game_id)function that:/ISteamUserStats/GetGlobalAchievementPercentagesForApp/v2/Modified Behavior
Updated
generate_achievement_stats()to:achievements.json.glbcontaining achievement names and their global unlock percentagesNew Configuration Settings
Added two new settings to
configs.main.iniunder[main::stats]:enable_global_achievement_percentages(default=1)global_achievement_percentages_update_interval_hours(default=0)Output Format
The
achievements.json.glbfile contains a JSON array with the following structure:[ { "name": "ACH_WIN_ONE_GAME", "percentage": 78.5 }, { "name": "ACH_WIN_100_GAMES", "percentage": 12.3 } ]Each entry includes:
name: The internal achievement identifier (matchesachievements.json)percentage: Global unlock percentage (0.0 - 100.0)Usage Example
When running
generate_emu_config.pyfor a game with achievements:If the API is unavailable:
Config generation continues successfully in both cases.
Benefits
Technical Notes
requestsdependency (no new dependencies)Files Changed
generate_emu_config_old/generate_emu_config.py: Added global percentages fetching logicgenerate_emu_config_old/_DEFAULT/1/steam_settings/configs.main.ini: Added configuration settingsWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.steampowered.compython3(dns block)python3 /tmp/test_achievements/test_global_achievements.py(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.