[PLUGIN] Clay.io (leaderboards & achievements)

0 favourites
From the Asset Store
Implement a customizable array-based achievement system with the fully-commented template.
  • Added that feature for leaderboards ("Fetch"). Basically you call fetch, it stores the data in an expression, so use the fetch completed condition and another condition that is a loop from 0 to Clayio.LeaderboardScoreCount. Then with that, you can use the expressions Clayio.LeaderboardScore and Clayio.LeaderboardName passing loopindex as the parameter, so: Clayio.LeaderboardScore(loopindex)

    Hope that makes sense, if not, the docs on it are here

    Right now it caches the list of available stats for a day which is my guess why they didn't show up. I need to find a better way to do that, but I cleared it for you (so it'll show up now)

    Changed "Plays" to be "Views" to be more clear.

    Thanks for all the feedback!

  • Amazing... will instantly be used on my game for the next update ;)

    Now it is time for the payment and items implementation (even with separate backend).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wow, wow, wow!

    It's a fantastic feeling to ask some question one days amd have the solution in the next - with advice or by a new feature developement!

    I have several questions in PM, may be interesting for C2 users:

    1. You may a Clay.io login box appears just after your game is loaded. To turn it on/off look at the Clay.io/admin/Yourgame/Settings and check/uncheck "Always show clay.io login box on load when a player isn't logged in".

    2) I did a mistake, and recorded about 6000 score submits in several seconds from C2 preview. Now there is a new "Clear Scores" link in the Clay.io/Mygame/Leaderboard screen, so this kind of bug may be solved...:)

    austin - I think the data is not removed from the statistic graph's tables.

    3) Now this is clear in Clay.io/MyGame/stats that the first stat type "Views" is how many times a game was loaded in a browser. And the "Plays" is how many times a user played a game.

    The first one is auto incremented, once your game is loaded (with Clay.io plugin)

    And we have an Action for the Plays: "Log Play" in C2 plugin.

    4. We now have an Action to get the Leaderboard date in the background, and show it for our gamers in the game's design.

    Do not panic, if you can not find Fetch Leaderboard Object action, it will appear if you try to add it in a For Loop! :)

    (You will need to download the new Clay.io plugin!)

  • If you reset again it should clear the stats as well now

    The fetch leaderboard action shouldn't be in the for loop (and should show up without it being in one). Here's what my setup looked like (obviously just for testing purposes, what this spits out isn't pretty at all):

    <img src="http://new.tinygrab.com/a160021eef07004174ed1c3e3a938d5d09b36ebd54.png" border="0" />

  • austin You are right! I will test and write only after that in the future. But I can not wait for my worktime to end and test the new Leaderboard function! :)

    I noticed, that my test with custom stat appeared in the statistic, what is great! I wonder if there is some delay (approx. 4-6 hours) between the custom stat is sent/recorded and it is displayed in the dropdown in Clay.io's stat.

    Unfortunately I did a mistake here again, so I have now "Level0" in the dropdown. If I ask about how to remove a custome metric, you may make a delete metics link... but it's not a high priority thing.

    It makes an another (long term) question: if somebody accidentally clicks to "Clear Scores" for a Leaderboard or for example "Delete Metrics" in this last case, it may be very big loss especially.

    My favourite solution for this is the MailChimp's one:

    • click to the delete button
    • you get a popup what tells, that you will delete "XY" and it can not be undone
    • you need to type in "DELETE" in a text input and click on to "OK, I understood, and want it!"

    It used to save my live... :)

  • Yeah that's not too big of a priority right now :)

    I have a confirm box in place for clearing the scores, so it's not too easy to do accidentally (though not as good as what MailChimp has). That's not a huge priority now either.

    I'd better get to integrating Multiplayer Rooms & Payments before the mob comes after me ;)

  • Hey Austin, this sounds like it could become a fantastic plugin. However I'm experiencing several showstopper issues with it.

    1) Uploaded game information disappeared from my profile. I created 2 games ("Cake Star" and "funstormtest") on my developer account ("wgfunstorm"). Both showed up in the list of my games. Then I logged out & back in again. Now "funstormtest" has disappeared completely, and "Cake Star" shows up under a blank name (I know it's that one because if I check out the stats I see a custom metric that I created). It appears there is still a trace of "funstormtest" somewhere in the system because when I try to create a new game with the same name it says it's already taken. It's just nowhere to be found on my profile.

    2) I can't get it to work with multiple layouts:

    • Everything works fine on the first layout that I use the plugin on.
    • The problem arises when I attempt to use it on any subsequent layout. Although the 'Ready' expression still returns '1', the 'Clay.io Ready' condition does not trigger, and any attempts to log a custom metric don't show up in the statistics.
    • I tested this with a barebones project with just 2 layouts and 1 metric to log on each.
  • Issues fixed (check your email)

  • Wow that was fast thanks! Count me as a fan.

  • Hello! First of all i want to thank you for this great plugin. Its concept it's awesome!

    But sadly, i am having a few problems and i can't make it to work. I read the tutorial about how implement the API and i read all the entries of this topic to see if i could find the error.

    • The first problem: (i don't know for sure if it's a Construct bug or the plugin itself)

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/ActionsBug.png" border="0">

    If i pass the mouse near some actions, they disappear. If i pass again they come back:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/ActionsNotBug.png" border="0">

    In the Conditions, just the "Leaderboard Score Posted" disappears. The Construct Native's plugins work fine and the others third parties plugins too. I don't think if it's a Graphic Card problem, but i can be wrong.

    • Now the second problem. I followed the tutorial and tried to implement the API in an game of mine. When i double-click the action "Show Leaderboard", it doesn't show no window for input the parameters. It just add the action and go back to the event sheet editor. The tutorial shows this window:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/ShowBug.png" border="0">

    But for me it's no good. It shows nothing, just go back to the event sheet editor. Okay then, maybe i did something wrong. Created a blank .capx and did a simple post score and show leaderboard system. Same thing, doesn't show nothing. I downloaded the test.capx :

    http://clay.io/plugins/scirra/test.capx

    And nothing too. When I run the project, any project with Clay.io or even the test.capx, this is what i got:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/noscoreBug.png" border="0">

    The debug mode it's disabled so i think i could at least post the score. But I'm not receiving data at all. I created a game in Clay.io site again, added a leaderboard to it and i got the same thing, no entries. Okay, so I searched more deeply and I found the Fetch action. Did a new post and show score system using Fetch this time. Used the Fetch like Austin explained, outside the loop:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/austinway.png" border="0">

    But it's look like that I sending a null value or receiving a null value. Cause this is the result:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/fetchbug.png" border="0">

    I'm sending this in Post Score Action:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/PostBug.png" border="0">

    I thought the APIKey could be wrong. To be sure, i created a new game, a new APIKey and a new LeaderBoard. See:

    <img src="https://dl.dropbox.com/u/5143153/BugClay.IO/APIkey.png" border="0">

    And the same result. I played other games at Clay.io and the scoreboard shows everything ok. If it helps, here the .capx i was using:

    https://dl.dropbox.com/u/5143153/ClayTest.capx

    Just for you know, when I post to Facebook Wall, the value goes right.

    I'm using

    • Google Chrome - 20.0.1132.57 m .
    • Windows 7 64bits.

    If you need the specs of my machine, let me know.

    Sorry for the long post. But even with some hits in the wall, I think this plugin is incredible and it will be a strong weapon for Construct 2 users. Great Job Austin, i hope you continue the good work.

    ps- Sorry for my English.

  • I'm really not sure what the deal with the missing actions and hovering over makes them show issue...I'll get in touch with Ashley on that.

    Fixed the issue on the "leaderboard show" options not opening up for you

    For the no names and 0's for scores, you need to add the loopindex parameter to each like:

    <img src="http://new.tinygrab.com/a160021eef18fed299876ba328d3c7b33810a8050a.png" border="0">

    I think that resolves everything you mentioned.

    Be sure to download the new plugin first: http://clay.io/docs/scirra

  • Austin! Thank you very much man! It's working now!

    Man! I totally missed the loopindex. My bad.

    Anyways, greate job, please, continue with the hard work that your team is putting in Clay.io. The best Construct 2 plugin ever!

    Cheers.

  • Heh, thanks <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Hi austin, thanks for the great help to the C2 community! I had a question around encryption. I've been reading your articles: clay.io/docs/encryption which explain how you can use JWT to encrypt the high score posts. Is there some way we can implement this with Construct 2?

  • I'll try to get that in with the next release (along with include payments and multiplayer rooms).

    It does require some sort of backend though, so with the current set of Construct 2 plugins, that'll probably end up being AJAX for most people. The big thing encryption prevents is the falsified leaderboard scores. However, a simple implementation of a backend isn't really going to do the trick - if you send the score over via AJAX to encrypt it, then send the encrypted object to Clay.io, the user can still fake sending a higher score over via AJAX. The best way to do it is keep track of the score with server-side logic, and verify what the client is sending is legitimate :)

    There are some interesting use cases for this. For example, in Word Wars, we generate the 4x4 board on the server, then run through all possible combinations of words - each possible word is hashed, then sent to the client along with a unique salt for each game.

    The client then hashes each word that is typed, and checks it against the array of hashes to see if it's a match, then updates the score for the client to see (so they know it was a valid word).

    At the end of the game, the list of non-hashed words the user came up with is passed to the server, and the server checks those against the list of all possible words and generates a score from that (the scoring algorithm is the same as the client side, so the scores will be the same).

    So basically my point is, it takes a bit of extra work to completely stop faked scores, but it's definitely not impossible with JavaScript :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)