Jump to content

Leaderboards


Josh
 Share

Recommended Posts

Can that be fixed in the future, if a stat drops.. if a custom string could be saved instead of numeric data, that could be one way around it.

I actually can do that, I just figured it would not be needed but I will see what I can do.

 

You don't need to have a "myGame" prefix because it will add your game's ID as a suffix automatically, to keep them separate (only when the app ID is 355500, which is what the game launcher uses.)

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Am I reading it right then that when ran from inside the LE Editor it doesn't put a suffix on and so if we have this leaderboard code in 3 different games they'd all share the same leaderboard (assuming we named them the same and ran it from the editor)?

Link to comment
Share on other sites

Because your game had no game ID passed to it in the command line, since it was not being run from the game launcher.

 

In the future it will use the Steam user ID for the suffix if no game ID is found. That will just keep your games separate from others.

 

If you want to name the leaderboard something unique, go ahead.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

In the future it will use the Steam user ID for the suffix if no game ID is found. That will just keep your games separate from others.

 

This makes it sound like because we aren't passing in the steam user ID in the editor right now that these leaderboard names are global to Steam? That can't be. I mean I can't just find the same name some other game in development is using and mess up their leaderboard today can I? That would seem crazy on Steams part to allow that.

 

Like if you are making a game in Leadwerks and call your leaderboard "leaderboard" and run this code from the editor today and I do the same, we aren't sharing that leaderboard are we?

Link to comment
Share on other sites

When you are developing your game, the default app ID is 480, so you are sharing leaderboards with everyone else using "spacewar".

 

When you run your game directly from Leadwerks Game Engine, it is actually initialized with the Leadwerks Game Engine app ID. This is just something Steam does since your game is a child process of the already-initialized Leadwerks Editor executable.

 

When you publish a game to Leadwerks Game Launcher, all games are sharing that app ID.

 

When you get your own Steam app ID you can use that and not share with anyone.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Leaderboards still don't work in Rolly when published on the workshop. :(

 

The beta branch is updated on Windows so that all fonts are always included now.

 

Apparently not, Last night I did a re-upload and still on my end of the game launcher, the font is missing. Tonight I'll reupload it to include all files this time.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

When you publish a game to Leadwerks Game Launcher, all games are sharing that app ID.

 

When you get your own Steam app ID you can use that and not share with anyone.

 

Oh, so even when our game is played from the game launcher we'll be sharing the same leaderboard scope space with all other games on the game launcher? Meaning it's kind of an honor system to not screw with each others leaderboards, assuming you can't see what a game used for the name.

 

I just tried from the editor. I made my own leaderboard for my game with a unique name. However when I display it the avatar is pure white, my name wasn't displayed and the score wasn't the score I passed to SetScore().

Link to comment
Share on other sites

hmm, now it's working this morning. Of course to get current score it seems like we have to keep getting the leaderboard object in the draw function you made. I had to restart my game to see my updated score. That's kind of a bummer seeing as getting a leaderboard seems like it has a little delay.

Link to comment
Share on other sites

if leaderboard==nil then

leaderboard = Steamworks:GetLeaderboard()

end

if leaderboard==nil then

return false

end

 

 

In your function on this post 'leaderboard' is a global variable in the show function so the first time you call this show function it sets it and it'll stay set. So the 2nd time you call this show function it's not nil so it won't get the leaderboard again, and doesn't get the updated score. I mean on my side I just get the leaderboard at the top of the function but your script here doesn't do that. It only does it if leaderboard is null which it won't be after the first time of calling the show function. I noticed this because I have it show when I hold the 'tab' key down so I can see it many times after setting the score and it wasn't showing the updated score.

 

If you gave the leaderboard variable local scope at the top of the function then it would work as desired and get the updated leaderboard each time the show function is called.

 

 

[edit]

 

I suppose you might be thinking the leaderboard variable inside Set() is the same as inside Show() but they aren't. Those are 2 different variables because the one in Set() is defined as local so it's only visible inside Set() and isn't the same variable used in Show() (just because they have the same name doesn't mean they are the same because of the scope difference). The one is Show() is global and the one is Set() is local and doesn't point to the same memory location.

  • Upvote 1
Link to comment
Share on other sites

I suppose you might be thinking the leaderboard variable inside Set() is the same as inside Show() but they aren't. Those are 2 different variables because the one in Set() is defined as local so it's only visible inside Set() and isn't the same variable used in Show() (just because they have the same name doesn't mean they are the same because of the scope difference). The one is Show() is global and the one is Set() is local and doesn't point to the same memory location.

DId you seriously just correct my code? That ain't cool bro. laugh.png
  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Ah cool, I noticed it would only update the leaderboard after a restart too but wasn't sure why. For some reason since I updated my game on the launcher it can no longer get the leaderboard, at least when I test it here. It seems to work ok when I test it via editor but no longer in the launcher, no idea why.

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

Ah cool, I noticed it would only update the leaderboard after a restart too but wasn't sure why. For some reason since I updated my game on the launcher it can no longer get the leaderboard, at least when I test it here. It seems to work ok when I test it via editor but no longer in the launcher, no idea why.

When you test from the editor, your app is using the Leadwerks app ID. When you run it from the Game Launcher, your app is using the game launcher app ID, and all the scores entered during testing will not show up.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Ok I understand but the leaderboard table just isn't showing at all for me in the launcher since I updated the game. On first upload it was showing fine at the start screen but instead now it lags like it's continuously trying to connect to it but fails. So I have since added a retry timer on fail to help eliminate the lag. I might try changing the name I'm using for the leaderboard next time to see if that gets it working again.

Check out my games: One More Day / Halloween Pumpkin Run

Link to comment
Share on other sites

  • 3 months later...

I think "best score" is determined by the sort mode the leaderboard was created with.

 

enum ELeaderboardSortMethod

{

k_ELeaderboardSortMethodNone = 0,

k_ELeaderboardSortMethodAscending = 1, // top-score is lowest number

k_ELeaderboardSortMethodDescending = 2, // top-score is highest number

};

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Looking at your example, you get a leaderboard, which is then automatically created I assume. But how do your create a leaderboard using the Create function listed in the API reference?

 

Without some examples in the API reference, I am only guessing as to what I should be using:

 

self.leaderboard = Leaderboard:Create(2)
self.leaderboard = Steamworks:Create(2)

 

post-45-0-86868000-1455570927_thumb.jpg

Link to comment
Share on other sites

Leaderboard* Steamworks::GetLeaderboard(std::string name="Hiscore", const int type = 1)

sets time or numeric, but not the sorting order.

 

It is not clear to me where I set this. I tried it is a third argument, but to no avail.

 

So for the code below, I would want the score of 50 to appear on the leaderboard.

 

if self.leaderboard==nil then
 self.leaderboard = Steamworks:GetLeaderboard("dontstopcounter", 1)
end

result=self.leaderboard:SetScore(50)
result=self.leaderboard:SetScore(80)

Link to comment
Share on other sites

Should work like this:

static Leaderboard* GetLeaderboard(std::string name = "Hiscore", const int type = Leaderboard::Numeric, const int sortmode = Leaderboard::Descending);//lua

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...