question

Talha avatar image
Talha asked

One Complete Interaction (acknowledgement)

Hi, I believe that playfab has given us enough tools in essential tier to Come up with an comple Acknowledgement between two playfab players.What i would like to implement is One complete interaction between two players.

E.g

Player1 nudges Player2.

Player2 receives nudge.

Player2 nudges back.

Player1 Receives the Nudge.

i.e one complete interaction.

Now my question is how to do it? in essential tier. Now nudge can be perceived as A friend request or challenge or anything really.

What I think is that It has to do with Player PlayfabID and player stats/internal Data.

scenario.

Player1 Pokes Player2.

Player1 Updates the stat "Poke" with Player2PlayfabID and "PokeResult" =0.

In cloudscript we update Player2's Stat "Poked" with Player1PlayfabID.

And retrieve the stat in Game and show player2 that They've been poked by Player1.

Now If they Player2 Clicks on button PokeBack. We run the cloudscript and update the stat "PokeResult" of Player1 =1;

And retrieve the stat in game to check if its 1 or 0. If its 1 then we Show player1 that he's successfully communicated with the Player2.

Save the Player2PlayfabID in Player1's internalData.

total Stats per player=

Poke. {PlayFab ID of Player YOU have POKED}

PokeResult.{Have they Poked you back, 1 mean yes 0 means No}

Poked.{PlayFab ID of Player who POKED you}

ie Player1 can only poke one Player At a time. and get poked by only one player at a time.

player1's poke limit is 5. If he needs to poke other players he must delete some playfabIDs from his current poked players.Which we'll do from Cloudscript.

Phew!

Could you please give your feedback on all this?

Friends
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

Hi, your design sounds good. At the current stage, we can give you the following advice.

1. Use Shared Group Data instead of stats.

If you refer to this thread, which provides a solution to a two-way confirmation friend system. In this case, "FriendRequests" is used as a sharing group data object. So, "PokeResult" can be used as a sharing group data object too. You can easily share group data between two group members. Please check the thread link and our documentation Using Shared Group Data for more info.

2. Do some control to ensure that at a time, one player can only poke one player and get poked by only one player.

If you use Shared Group Data to store "PokeResult", you can control that who can update this "PokeResult" by controlling shared group members. When multiple players are able to update Shared Group Data (even through Cloud Script), always write to a Key which incorporates the player's PlayFabId, so that there's no chance of two players trying to update the same Key with different Values at the same time.

1 comment
10 |1200

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

Talha avatar image Talha commented ·

Thanks alot for your feedback, I'll check the links you provided. I'll post here if i hit walls along the way. :)

0 Likes 0 ·

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.