How would I setup PlayFab high scores in PlayCanvas?

EDIT: It occured to me just now that this is more of a question for PlayFab then for PlayCanvas community. I’ll leave this here in case anyone has some input, but I will be emailing their support instead of rambling here. Actually, I might even end up using a different service entirely, since I did more reseach and discovered heroiclabs.com also offers some high scores solutions, and their support actually is helping me.

Feel free to delete this topic if it’s in the way and no one else cares for it. :wink:

Original post follows below.

You’ll have to forgive my total noob outlook on this. I have never actually done any integration outside of making Unity executables talk to things. I also have not parsed any Jquery or whatever these high scores pass back, I’ve always worked a level higher in the chain, doing things like ShowHighScoreTable(“nameOfTable”). Or using Multimedia Fusion 2.0 to call Mochi high scores table objects into existence magically in MMF. (RIP Mochi.) So I have NO IDEA what I am doing. :stuck_out_tongue:

I have signed up for a PlayFab account here, to try to add high scores to my game. I used their site to make a “game” entry for my game, and now have a fancy access code thingy, which I suppose is supposed to be combined with their SDK somehow. I have no idea where to go from here.

I need a crash course in what to do next. The game in question is meant to be a contest entry, as such I am not allowed to use the downloaded Playcanvas SDK outside of the Playcanvas online system. I assume I can just upload the PlayFab SDK files to the project and have it magically work if I attach it to a scene object, but I have no idea which SDK to get, or how to actually go about setting that up.

Can someone give me a rundown what steps I would take to get from a basic play canvas app to having high scores pop up on the screen?

Looks like you should be able to download their client SDK for javascript and include it in your project.

To include a library like this add it to the Script Priority list in your scene. This will ensure that it is loaded before any other scripts.

You should then be able to use their SDK like regular javascript code in any of your scripts. I’d suggest working through their getting started guide.

Ah, thank you Dave. While I am using heroiclabs.com 's service now, your post was one of many pieces that helped me understand how to plug in libraries, and the procedure is the same for most of them.

I had no idea the Script Priority section existed. I have since found the instructions about it on the manual at the very bottom of this page by searching for how to add libraries. (Now that I finally understood the terminology I knew what to search for.)

http://developer.playcanvas.com/en/user-manual/scripting/script-priorities/

It’s kind of easy to miss where it’s located unless one reads the manual cover to cover.

I finally connected two and two together thanks to that help doc, and now understand how to import any libraries I want to use into playcanvas. Suddenly all the high scores systems documentation makes a lot more sense to me. :bulb:

Since nobody from PlayFab has followed up on this thread, let me chip in with a suggestion for an alternative. Google’s Play Games Services are pretty cool!

I used them for the achievements and leaderboards in my game Accelerally. The scripts you want to look at are:

I wrote the game a long time ago so I’m not sure I’d implement exactly the same way if I did it over, but I hope you find it useful anyway.

Thanks for the suggestion. I do plan on getting into google play services sometime. The main tools I use for game design right now are Unity and App Game Kit (and now currently playcanvas for the contest entry). All of which output to android devices naturally, so in the future I’d love to hop on board the mobile market and use play services exclusively. Especially since google also offers an ad service, it would be really nice to have everything under “one roof”.

I’d love to implement them for my contest entry too, but I don’t have the funds to do it for now. There is a 25 dollar fee that needs to be paid from a bank account to enable a google account for store publishing and play services access. Real Life issues I’d rather not get into here keep me from spending any more money on development, so I have to stick to a budget of “my time” with 0 as my investment costs.

So for now I will press forwards with using heroiclabs.com to run the leaderboards, and search around for a decently paying banner ad service if I have time to do so.

Hi all,

First off, sorry that some of the links aren’t fully qualified with an https, but apparently as a new user, I’m not allowed more than two links in the post. Please prepend the https colon whack whack when checking them out. :smile:

I’m the chief developer relations engineer for PlayFab, so hopefully I can help to fill in the gaps. Sorry for not responding sooner, but I’ve only just been pointed to this thread. We do have a support forum on our site, where we make very sure to provide detailed answers on how to use any component of our service, so I’d highly recommend using it if you have any questions at all.

From reviewing the PlayCanvas docs, I’d say that Dave’s recommendations are likely your best bet, though you could also just use the HTTP functionality to call into our service as well - our service is Web API based, so we’re very platform agnostic.

Before starting on a project using PlayFab, the first question you should ask yourself is what your shipping game format will be. The reason I point this out is because I believe the fancy access code you’re referring to, darkgriffin, is the Secret Key, which is used to make calls against our Server API, which is used for server-authoritative logic, and the Admin API, which is used to configure your game. That’s not something you would ever want to have leak, so if your game is purely web hosted, that’s one thing, but if you’re following any of the guides to convert your project to run on PC or as a downloadable for one of the mobile platforms, you’ll want to stick to using the Client API only in your project. But even in those cases, you still have the ability to write any custom server-authoritative logic you need as JavaScript handlers, and host those in our Cloud Script system (https://api.playfab.com/docs/using-cloud-script/), so you can still make sure the key elements of your game are secure.

Now, with that decided, and sticking with the Client API for the moment, it sounds like the two things you were looking for to start are authentication (api.playfab.com/Documentation/Client#Authentication) and leaderboards (api.playfab.com/Documentation/Client#Player%20Data%20Management - check for the Statistics and Leaderboard calls). We’ve also added resetting leaderboards, so you can define your stats to reset on a regular interval if you want to have things like daily/weekly/monthly leaderboards - more on that here: api.playfab.com/docs/using-version-statistics/.

One other thing that may interest you is the realtime feed of all events for your game, whether coming from the user’s instance or any third-party integrations you use via our Add-ons marketplace: playfab.com/blog/playfabs-new-game-manager/. We’re going to be doing a lot more with that very soon, so you can expect another post from us in the coming weeks on that.

Meanwhile, if you have any questions at all, please feel free to reach out to us on our forums at https://community.playfab.com, or email us directly at devrel@playfab.com. I’ll also keep an eye on this thread for any additional posts, of course.

EDIT: Oh! And we also have a repository of some essential Cloud Scripts you can check out in our GitHub (GitHub/PlayFab), which is also where you can get all our SDKs, as well as sample projects including a full MOBA game example. We have indexed pretty strongly on Unity, I will say, since we have a large number of Unity devs using our service, but we’re happy to provide pointers for folks using any other language.

2 Likes

If you guys have interest in making examples, you would be the best to show a good use of integration with PlayCanvas, and then we can feature and pin somewhere your integration example, so people have no problem finding it :slight_smile:

Tanks, Max - that’s definitely something we’re interested in, it just might be a little while until we can get time in the tools team to work on this. We’ve got big plans for GDC - hopefully, we’ll get to meet with some of you there!

2 Likes

I guess the team never managed to find a time and tools to make an example, sadly. :frowning:

Unfortunately, we’ve had very few requests for a PlayCanvas example, so our team (PlayFab) hasn’t been able to prioritize this.

1 Like

I use the combination of PlayCanvas and PlayFab for nearly 18 Month. There have been next to nothing issues with the implemantation. You can take a look at Herbivore how I’ve done this… :cucumber:
I think a example for leaderboards could be found at RopeJump in the gym and in ranking (pocal button in the main menue)