Download

Steam - Read Leaderboard Integer : Failed

Hello,

I have setup my Steam partnership and I’m trying to Read/write leaderboard, but it fails.

Been searching and watching videos for hours now, it’s a bit frustrating.

The weird part is I’ve successfully setup the achievements. They work just fine, but not leaderboard T.T

Help would be really appreciated.

PS : Actually only Read fails. The Write Leaderboard Integer returns True (but I don’t see any entries in the steam leaderboard page)

Hum, if I remove the leaderboard from Steam Leaderboard page, the game doesn’t output Failure (nor success of course).
So I assume the connection with Steam seems to work. I just don’t understand why it fails.

Phew, finally found out why.
I’ll post the answer here for anyone who get there looking for the same answer.
On the steam page, it’s required to also set something in the Stat page with the name of the leaderboard with underscore then the name again. Just like this :
leaderboardname_leaderboardname

Found here :
https://answers.unrealengine.com/questions/499819/steam-leaderboards-cant-get-it-to-write-score-valu.html

but there is a problem, the score always increment, it’s a known issue and can’t be fixed with blueprint. Although as a workaround, what’s possible is to deduct your highscore from your current score.

Hey all, thanks for the above postings. I feel like the forums have got me close. I’m using UE4.23.

I have same problem, can’t get Write Leaderboard Integer to do anything. Following youtube tuts I can get the Steam Username and unique player ID to print when running standalone in editor.

My C++ ability is nonexistent. I read that to implement the Advanced Sessions plugin it helps on a mac (yup, I’m on a mac) to create a blank C++ file. So I did that, and rebuilt the ue4 project in xcode. Then opened the project through the Epic Games Launcher. That’s the version I’m using in my attempt to get the game to talk to the Steam leaderboard.

I am running Steam before opening my project.

My in-game scoreboard Widget reads and prints my Steam username. I have a Steam app ID, as I release next week. I put that appID in the DefaultEngine.ini file, where tuts usually have the Spacewar “480”. So in the editor there’s enough communication with Steam to get the username and unique ID.

On Steam I set up a Steam Stat called CWScore_CWScore. The stat name in my Write Leaderboard Integer node is “CWScore”. I read somewhere else that firing that node creates the Leaderboard on Steam and makes the first entry. Didn’t happen for me.

So I created a Leaderboard on Steam’s Leaderboard page and called it “CWScore_CWScore”. Published it. Still couldn’t get a score from my game to the Leaderboard.

So I renamed the Steam Leaderboard to “CWScore”, published that, tried again. Same non result. Still won’t write to the Steam Leaderboard.

Do I need to cache achievements somewhere? (My game has no achievements.) Do I need to use a Start Advanced session node? I messed around with that with no result. Do you need any nodes in front of Write Leaderboard Integer to make that node able to do its job?

Maybe I need to put some actual C++ code in the blank .h and/or .cpp files? I’ve tried to cut and paste code into those files, and due to my ignorance, each time I do that and try to compile the project, if fails with errors I can’t decipher, and then I can’t reopen the project because I get “missing module” type errors". So I just trash it and get my backup …

Any assistance would be much appreciated. If I do need extra C++ code, please bear in mind that I will need pretty thorough instructions about which file(s) to copy them into with xcode, and any formatting necessary.

Thank you!

Sorry to post again. I tried one last thing:

I typed the linked code into my BlankCPPFile that UE4 autogenerated. Here’s the code I typed: (I didn’t type the quotes)

"void ALeaderboardTemplate::LeaderboardWriter(FString LeaderboardName, int32 ScoreValue)

{

IOnlineSubsystem* ion = IOnlineSubsystem::Get();

TSharedPtr<**const** FUniqueNetId> pid = ion->GetIdentityInterface()->GetUniquePlayerID(0);

if (ion) {

    FOnlineLeaderboardWrite WriteObject;

    TArray<FName> NamesToWrite;

    NamesToWrite.Add(TEXT("CoronaWhomp"));


    writeObject.LeaderboardNames - NamesToWrite;

    writeObject.SetIntStat(TEXT"CWScore"), ScoreValue);

    writeObject.SortMethod= ELeaderboardSort::Descending;

    writeObject.UpdateMethod = ELeaderboardUpdateMethod::KeepBest;

    FName SessionName = TEXT("CoronaWhomp");

    FOnlineSessionSettings Settings;

    FOnlineSessionSearchResult chrishartedits;                       

if (pid.IsValid()) {

        ion->GetLeaderboardsInterface()->WriteLeaderboards(SessionName, (*pid), WriteObject);

    }

}"

The only error xcode gives is for the first line: ALeaderboardTemplate is maybe an “Undeclared Identifier”? If anyone who knows C++ can look at that and say, oh yes that snippet will work you just have to add … something … to clear that error; that would be great. It may not be possible, I’m aware of my ignorance.

Thanks!

Ok, answered my own question. Hah!
The DefaultEngine.ini file has extra code to make the Steam Online Subsystem work. Specifically you enter your SteamAppID. Also, you need to enter the same number as the SteamDevAppID. I didn’t know what that was so I had left it on the Spacewar default. Another thread mentioned you needed them both to be your appID. Finally, the Leaderboard writes my score!

Also, I haven’t tested this yet but for readers with this same set of issues, you need to make a plane text file called steam_appid.txt. It’s a basic text file and the only thing in it is that same appID. AFTER YOU PACKAGE your build, before including it in a Steam depot, copy that text file into the Gamename.app/Contents/UE4/GameName/Binaries/Mac folder. That’s for Mac, on Windows it’s a Binaries/Win64 folder in a very similar location.

Good luck all, and sorry for taking up so much forum real estate!!!

I struggle with steam leaderboard, find tons of threads with questions and people gives small advises, but still no score shows up in my steam works list. I also tried to add a steam stat with Leaderboardname_Leaderboardname, but still no luck on getting scores in steam works leader board. Steam is generally running fine, create and find session works.

If somebody of you can give a clear description what to do to write scores with “wrte leaderboard integeer” BP node to the steam works leader board, would be great.
If you also get it done to get all highscores and show it to the player, would be nice to see how it works in BP or how to populate needed fucntions to BP.

Got it. Don’t know exactly what was the reason why it was not working, but now it works.

  • Add On Steam works “stats” pagge a new “stats config” with “API Name” entry “Leaderboardname_Leaderboardname”. (As the posts above also advise)
    – Use a itself Leaderboardname without underscore “_”, just add the _ between two times the leaderboard name.
  • Add On Steam works “leaderboard” pagge a new leaderboard with name “Leaderboardname” (only one time, no underscore)
  • Start you game as stand alone game by right klick your project and launch game or start a build/cooked game. Steam integrations is in general not working in Editor game starts.
  • Of course steam has to run and your general steam connection between game and steam has to work fine. (you see in your friends list on your name that you play the ue4 game you have started when everything works fine)
  • Then for me… Blueprint node “Write leaderboard integer” works like expected and wrote its integer to the leader board.
  • I also do not face the problem that my values are just “increased”, my values are replaced. That was also my intention.

EDIT: Not fixed completly. Now I can read (read leaderboard integer) a value, update the value (write leaderboard integer), then read the updated value again (read leaderboard integer) and the updated value seems to be correct.
But log in into steamworks, it shows me that the value is not updated. Interesting on that, by restart the game the values I catch (read leaderboard integer) still have the updated values from the last game run. But still, when log into steam works and look at the leaderboard, the changes are not shown here. Seems to be the values are “somehwere” temporary(?) saved.

@TheFlow3k hi, have you found a solution to this, by the chance?
“But log in into steamworks, it shows me that the value is not updated. Interesting on that, by restart the game the values I catch (read leaderboard integer) still have the updated values from the last game run. But still, when log into steam works and look at the leaderboard, the changes are not shown here. Seems to be the values are “somehwere” temporary(?) saved.”

We talked already at " UE4 answers". But for the next one finding this thread, please go to UE4 answers and read this thread with some recommendations from Arfeus and me:
https://answers.unrealengine.com/que…he-stat-v.html

WORKING Progressive Stat Achievements in UE4 for Steam in Blueprints here:

Hello everyone. I too ran into this problem. Anyway I got it to work. I made a video about it to show step by step here. https://youtu.be/Me2z2ZEH4ac