Skip to content

Conversation

@DESTROYGIRL
Copy link
Contributor

Description

This fixes achievement progress being removed on game restart and should allow for achievement progress to be saved across systems. This also improves communication with the steam stats API for component type achievements

Toolchain

  • Windows MSVC VS2022

Linked Issues

@DESTROYGIRL DESTROYGIRL added this to the Bug Cleanup milestone Jan 22, 2026
@DESTROYGIRL DESTROYGIRL requested a review from a team January 22, 2026 14:59
Comment on lines +531 to +534
bool bRet = steamapicontext->SteamUserStats()->SetStat( pszProgressName, m_iCount );
if ( !bRet )
{
DevMsg( "ISteamUserStats::GetStat failed to set progress value in Steam for achievement %s\n", pszProgressName );
Copy link
Collaborator

Choose a reason for hiding this comment

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

Possibly a typo in the DevMsg method name (The print message says GetStat but the bRet error originated from the SetStat call)

Also maybe we want DevWarning instead of DevMsg, since this is something going wrong.

#ifdef NEO
else
{
Warning("CAchievementMgr: Failed to write to steam cloud! Expected size %d got size %d\n", filesize, nRead);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Technically not an error in CAchievementMgr, since we're inside the free-standing static function WriteAchievementGlobalState. Perhaps instead format as Warning("%s: ...", __FUNCTION__, where __FUNCTION__ will be automatically substituted by the current function name by the compiler

{
// Read in the data from the file system GameState.txt file
#ifdef NEO
FileHandle_t handle = filesystem->Open(szFilename, "rb");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to open the text file in binary mode? Encoding related?

Comment on lines +37 to +41
#ifdef NEO
CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_On );
#else
CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_Off );
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

Opinionated, but perhaps instead of modifying the base SDK constructor defaults, it might be cleaner to instantiate our NEO-specific instance with the desired value:

diff --git a/src/game/shared/achievementmgr.h b/src/game/shared/achievementmgr.h
index 7a990fbf..c33261e2 100644
--- a/src/game/shared/achievementmgr.h
+++ b/src/game/shared/achievementmgr.h
@@ -34,11 +34,7 @@ public:
         SteamCloudPersist_On,
     };

-#ifdef NEO
-       CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_On );
-#else
        CAchievementMgr( SteamCloudPersisting ePersistToSteamCloud = SteamCloudPersist_Off );
-#endif

     //=============================================================================
     // HPE_END
diff --git a/src/game/shared/neo/achievements_neo.cpp b/src/game/shared/neo/achievements_neo.cpp
index caef7bf8..b6a005ff 100644
--- a/src/game/shared/neo/achievements_neo.cpp
+++ b/src/game/shared/neo/achievements_neo.cpp
@@ -2,7 +2,7 @@
 #ifdef CLIENT_DLL
 #include "achievements_neo.h"

-CAchievementMgr g_AchievementMgrNEO;   // global achievement mgr for NEO
+CAchievementMgr g_AchievementMgrNEO(CAchievementMgr::SteamCloudPersist_On);    // global achievement mgr for NEO

 class CAchievementNEO_TutorialComplete : public CBaseAchievement
 {

But if you prefer this way, I'm ok with that too, so I don't necessarily require a change here.

@Rainyan Rainyan requested a review from a team January 29, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tutorial completion achievement progress is not saved between sessions

2 participants