[PLUGIN] Clay.io (leaderboards & achievements)

0 favourites
From the Asset Store
Implement a customizable array-based achievement system with the fully-commented template.
  • Hey folks, I just finished up version 0.1 of the Clay.io Construct 2 plugin!

    I'm one of the co-founders of Clay.io and we're trying to do a couple things with the site. One is we've created a cross-platform marketplace just for HTML5 games - you can check that out here. The other thing we're doing, which pertains to this plugin, is the Clay.io API.

    Our API makes a lot of the high level features in game development easy to implement. These features include leaderboards, achievements, analytics, etc.

    For the Scirra plugin, the following features have been implemented:

    • Leaderboards
    • Achievements
    • Analytics
    • Posting to Facebook Walls
    • Tweeting
    • Posting to the Clay.io stream
    • Cross Promotion
    • Ratings

    Here's the link to the plugin & documentation for it.

    This is the first version of the plugin, so do let me know if you have any suggestions on how I can improve it, or if you run into any bugs.

    If you'd like to add advertisements and cross promotion to your game, see our complimentary plugin for it.

  • Looks good! Interesting plugin. A few suggestions:

    • most of your conditions look like they should be triggers instead - take a look at the cf_trigger flag and runtime.trigger()
    • there was some commented out code involving taking a screenshot - if you want to support this, integrate with the existing 'Snapshot canvas' system action. It triggers 'On canvas shapshot' which then saves a data URL in the CanvasSnapshot system expression. It's done this way because toDataURL only works in a particular place in the source, which is why toDataURL() won't have worked if you tried it from the plugin.
    • the plugin will be broken by minifying on export. Have a look in the SDK docs about Closure Compiler.
  • Awesome plugin!

    Also i noticed about Snapshot canvas, then Ashley already explained about it. You might to update your plugin with Ashley's suggestion.

    I can't wait to try it udpated plugin!

  • Thanks guys! I'll get those fixed done and uploaded later this evening

  • Updated the plugin with everything other than the screenshot fix. Is there a good way to access the SnapshotCanvas method and the later canvassnapshot system expression?

    What I had to try and test it out was extremely hacky and wasn't working yet

    cr.system_object.prototype.acts.SnapshotCanvas( 0, 100 );

    setTimeout( function() {

         var ret = { set_string: function( str ) {

              window.open( str );

         } };

         cr.system_object.prototype.exps.canvassnapshot( ret );

    }, 500 );

  • Just what I was looking for, I�ll test it later ;] Thanks!

  • austin - don't try to call the action yourself. Simply document that the user should use this action, then pass the resulting data URL to your plugin in the 'submit screenshot' action or whatever.

  • Thanks Ashley. The plugin has been updated with screenshot support (you can even post the screenshots to Facebook & Twitter).

    Also added is the "Debug Mode" property - if this is enabled, achievements you earn won't show up on your Clay.io profile or stream, and high scores won't be added to live data. Just make sure to turn that off before publishing your game!

  • I tested it and i loved this plugin!

    It saved me a lot of time to create my own achievements engine, so i don't need keep it anymore.

    I stay with Clay.io

    I have some questions:

    1- Is possible to edit CSS of notification window from Clay.io? No extra DIV needed. I would like to match the design which is related to the game for gaming experience.

    2- Do Payment and Clay.Achievement.showAll(); APIs will be implemented later?

    3- Isn't possible to implement Encryption on C2?

    Thanks for making this awesome plugin!

  • Also i found a bug about canvas snapshot

    I changed PNG to JPEG, i found an error.

    Error: requested file is not an accepted type: /home/platform/public_html/images/screenshots/1277/258.png

    Clay.io stream only accepts PNG image file, but JPEG isn't accepted.

  • 1) As of right now you have to override our CSS on your page. Our CSS stylesheet is inserted after the first <script> tag, so as long as you have your CSS after the first <script> tag in index.html, all of our stuff should get overridden.

    Chrome's dev tools/firebug will be your best friend for this, but the structure for achievements is:

    .clay-achievement

    .clay-achievement-header

    .clay-achievement-content

        (if there's an icon for the achievement you'll have these as well)

        .clay-achievement-icon

        .clay-achievement-description

        (endif)

    .clay-achievement-close

    2) The payment API being integrated into the plugin is on the todo list. I've integrated "Show all achievements" and updated the plugin with it

    3) Encryption isn't possible right now. I'm not familiar enough with Construct 2 to know if you can create a backend for your game. So long as you have a backend, you'll be able to. Perhaps there's a way to get it working well with the AJAX plugin, I'll have to take a look

    4) Fixed (no need to update the plugin for this fix to work)

  • austin

    "payment API" ! It's cool~

  • This is very relevant to my interests!! Nice work!

  • Hi, I can�t make the plugin work. Can someone post a small .capx without the API IDs just so I can see if I�m doing something wrong?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • http://clay.io/plugins/scirra/test.capx

    That's a very basic implementation of it. If you hold the space bar down, the score will go up, when you left click on the score, it will post it and show the leaderboard.

    Let me know if you figure out what's going wrong!

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