[PLUGIN] Clay.io (leaderboards & achievements)

Post your completed addons to share with the community

Post » Wed Jul 11, 2012 8:56 pm

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.austin2013-09-27 18:21:47
B
24
S
8
G
4
Posts: 208
Reputation: 6,152

Post » Wed Jul 11, 2012 10:16 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jul 11, 2012 10:21 pm

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!

B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Wed Jul 11, 2012 11:04 pm

Thanks guys! I'll get those fixed done and uploaded later this evening
B
24
S
8
G
4
Posts: 208
Reputation: 6,152

Post » Thu Jul 12, 2012 12:41 am

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 );
B
24
S
8
G
4
Posts: 208
Reputation: 6,152

Post » Thu Jul 12, 2012 8:39 pm

Just what I was looking for, Ill test it later ;] Thanks!
B
38
S
8
G
3
Posts: 438
Reputation: 6,869

Post » Fri Jul 13, 2012 12:13 am

@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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Jul 13, 2012 3:00 am

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!
B
24
S
8
G
4
Posts: 208
Reputation: 6,152

Post » Fri Jul 13, 2012 3:28 am

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!


B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Fri Jul 13, 2012 3:44 am

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.
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Next

Return to Completed Addons

Who is online

Users browsing this forum: Vol6tmetr and 1 guest