I’ve associated my achievement in steam with a stat (0-100). If I attempt to update the achievement progress by calling WriteAchievements with a value of 10, it’s instantly unlocked and it’s progress is 100.
According to the Steam docs, I shouldn’t even have to write an achievement, only the stat:
Progress Stat - Specifies a stat that's used as a progress bar in the Community for this achievement. The achievement will also automatically unlock when the stat reaches the unlock value.
What’s going on here? Is anyone out there writing stats (without going through the leaderboard)?
My first thought is that you have registered the stat in Steam with a value of 0-100. The achievement takes a percentage (see SetFloatStat above), likely meaning a value between 0 and 1. If you set it to 10 I would think that equals 1 and therefore 100%. Try submitting your stat with the value being between 0 and 1 instead of 0 and 100. I imagine Steam does the interpolation for you.
First, thank you for the reply - much appreciated.
For quick testing, I’ve been using the blueprint node WriteAchievementProgress. I tried creating a new stat that is a float, associated it with the achievement and published my changes on steam. However, any non-zero value (even fractional) simply unlocks the achievement and returns 100%.
On line number 203 in OnlineAchievementsInterfaceSteam.cpp there is a questionable line:
NewAch.Progress = bUnlocked ? 100.0 : 0.0;
So that explains the constant 100 being returned. Even if it returned the correct value I wrote, the achievement is still unlocked immediately.
I will try your C++ snippet and see if I get a different result…
I’m completely stumped. I followed the code chain starting from IOnlineAchievementsPtr::WriteAchievements all the way to Steam’s SDK header file. WriteAchievements queues a FOnlineAsyncTaskSteamWriteAchievements. This task takes in a WriteObject but never actually does anything with it. It Ticks with a parent method and doesn’t do any writing. It then calls OnWriteAchievementComplete which I think is the offender. Starting at OnlineAchievementsInterfaceSteam.cpp:110 it seems to treat all submissions as “unlocked” without any regard for the actual stat progress.
for (FStatPropertyArray::TConstIterator It(WriteObject->Properties); It; ++It)
{
const FString AchievementId = It.Key().ToString();
for (int32 AchIdx = 0; AchIdx < AchNum; ++AchIdx)
{
if ((*PlayerAch)[ AchIdx ].Id == AchievementId)
{
// Update and trigger the callback
(*PlayerAch)[ AchIdx ].Progress = 100.0;
TriggerOnAchievementUnlockedDelegates(PlayerId, (*PlayerAch)[ AchIdx ].Id);
break;
}
}
}
Has anybody that has actually used Steam’s achievement system gotten an achievement progress submission to work? It seems to be black and white with it is either unlocked or it isn’t.
Just a quick update on this as I am currently in the middle of doing Steam achievements. From my understanding/research this functionality is broken for Steam OS, you have to use their Leaderboards for incremental Achievements. This is hasn’t been fixed in 4.12 as far as I am aware.
Although the leaderboards aren’t public, and I don’t have to maintain the service, it seems crazy to use a global leaderboard to track progress for a single variable. In addition, you’d have to track that progress in your app before making the call to unlock achievement. I’d rather drop achievements altogether than do this.