Hi, can anyone point me to a tutorial (video or written) with the basics of setting up Shared Group Data which is aimed towards beginner-level programmers. My game is a 1 vs 1 'boardgame' style setup. So far I have all my webhooks setup with Photon and everything seems to be working fine. All I want is to have persistent rooms between each player, and have each in-game 'raised event' stored so the other player can receive them when he/she logs in. Been searching around but have had no luck.
By the way, I accidentally posted my question before I could finish it, is there a way to delete your own forum posts? or at least be able to edit the title?
Thanks
Hi, I only found this tutorial about shared group data: https://docs.microsoft.com/en-us/gaming/playfab/features/social/groups/using-shared-group-data
You can set up a lobby system using Photon, creates rooms for 2 players( 1 v 1), use shared group data to store the data between the two players. When someone enters the room, use webhook to send messages to he/she. I don’t know exactly what problems you are having when using PlayFab, could you point out the specific issue you are facing?
By the way, these threads may help you as well:
https://community.playfab.com/questions/21248/sharedgroupdata-what-and-how-to-use-it.html
https://community.playfab.com/questions/3843/use-shared-group-data-for-a-live-event-system.html
Is there a way to delete your own forum posts? or at least be able to edit the title?
Can you find the button for that? If not, just contact us and we will do it for you.
Hi Citrus, thanks for helping out. Well it's more to do with how to type the cloud script. I searched for some sort of template and found this one @ ''https://github.com/JohnTube/MemoryDemoCloudScript/blob/master/MemoryDemo.js''.
It was created by Hamza at Photon for the Memory Game Demo on Unity. Figured my game would be a similar setup, so I thought I'll copy this script into my Playfab cloud as it doesn't look like something I could have worked out myself. All I changed was added Write Title Events to the handlers so I could see they were being called in my Playstream.
So with the first step which is creating a Shared Group Data, in my cloud, I can see the RoomCreated handler gets called when a new a room is made in my game. Within this handler, there is ''if (args.Type === 'Create') {onGameCreated(args, timestamp);''I checked and the args.Type is 'Create' so this should get called.
Then within onGameCreated, there is "createSharedGroup(args.GameId);" However when I search my Game ID @ ''https://developer.playfab.com/en-US/CB24/shared-group-data'', it comes up empty.
Hi, what do you mean empty? I checked your title and did a little test on my side, it seems that you’ve only created Shared Group but haven’t added any data in it, is this the case that you think it’s empty? If so, you may need to call UpdateSharedGroupData API to add data in it. If not, please provide more details such as screenshots for us to investigate, thanks.
Maybe I am not searching correctly. I've attached a screenshot on my search results:
. I was told to not have ''_GamesList'' at the end of the ID, unless it is a user playfab ID. I assumed there was no Shared Group Data under my game ID because whatever I type in the search I get the same results anyway.
Regarding updating the shared group data, this should happening as it is in my cloud script. Here is the full function:
function onGameCreated(args, timestamp) { 'use strict'; var data = {}; createSharedGroup(args.GameId); data.Env = {Region: args.Region, AppVersion: args.AppVersion, AppId: args.AppId, TitleId: script.titleId, CloudScriptVersion: script.version, CloudScriptRevision: script.revision, PlayFabServerVersion: server.version, WebhooksVersion: undefinedOrNull(args.Nickname) ? '1.0' : '1.2'}; data.RoomOptions = args.CreateOptions; data.Creation = {Timestamp: timestamp, UserId: args.UserId, Type: args.Type}; data.Actors = {1: {UserId: args.UserId, Inactive: false}}; data.NextActorNr = 2; updateSharedGroupData(args.GameId, data); updateSharedGroupEntry(getGamesListId(currentPlayerId), args.GameId, data); }
I've been told it's better to have the Shared Group Data to be made for each player then they are created. I assume this to share the data load over different groups. But for now just want to see why the above isn't working.
Regarding deleting a posted question, where should the delete button be located? Not sure how I'm not seeing it....
Thanks!
Ok thanks Citrus. I had already set up Postman and installed Playfab's JSON collection. I've been successful in user registration and logging in. Any tutorials with testing the cloud script itself though? What were the basic steps you did to test my function OnGameCreated ()?
Thanks!
Hi, you can call server/ExecuteCloudScript in Postman, don’t forget to fill up the SecretKey, Function name ( such as OnGameCreated() ), parameters etc. Any issues let us know:)
4 People are following this question.