question

Nicolas Vlahov avatar image
Nicolas Vlahov asked

Working with shared group data for facebook instant game (javascript)

Hi everyone,

I have been working on making playfab works properly with facebook instant game.

Login a user on playfab using facebook instant game ID has been quite easy, thanks for that.

However, using any of the SDK is a real pain. I'm about to explain myself.

I would like to create sharable data for 2 players playing in the same facebook instant game context. It seems that shared group data is what I'm looking for : a small group ( 2 players ) , sharing data one after the other, in a async way.

When looking on the doc, both Server and Client side can create shared data group. However, when clicking on the link that redirect to a tutorial of how to use shared data group, it explains how to write a cloud script using server side functions.

This is very unclear.

When digging into the playfab client SDK, on that link : https://download.playfab.com/PlayFabClientApi.js

I can find "CreateSharedGroup" functions. So why would I use a cloud script ?

When looking on the doc on your website, there's a code using "POST something", that is very unclear of how to use it with javascript.

Moreover, any tutorials found for executing cloud script is with C# ...

So what should I do ?? I tried a lot of way but none of them works.

I tried using clients side function to create groups : doesn't work

I tried cloud scripting and execute cloud script : doesn't work

So please, if any one could give me a very simple way to share data between two player for facebook instant game purpose. Please help me.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

The reason why we use Cloud Script to implement an asynchronous turn-based multiplayer game is that the order of turns should be determined by server-side instead of client-side. If only client APIs are involved, it will be difficult for players to confirm whose turn it is during the game. Implementing server-side game logic to handle turn switches will make Cloud Script work like a referee to ensure the fairness and avoid abusive use.

Besides, using Shared Group Data on clients may have potential security risks. You can check this section of the documentation about client permission concerns.

About how to use the PlayFab SDK with javascript, you may refer to our official GitHub repository, which includes the example of ExcuteCloudScript in the project.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.