question

chorustempo avatar image
chorustempo asked

Accessing Group Objects Shared Data With Blueprints

Hello,

I'm tearing my hair out trying to work with Playfab via blueprints, mainly as there is so little clear documentation on it! Please can someone help (and let me know if there is a visual blueprints guide to Playfab somewhere that I've missed)?

Context:

I have a handful of groups that all players in the game can access to see which board minigame groups are empty / waiting for players / full. Each group has 2-5 objects that contain a short string of data with the minigame reference, game state, and which 'chairs' are free in format "GameRef": "Empty, N, N, N, N". When the minigame menu is loaded, the client reads the objects of a few groups (depending on which minigame type they chose). Based on the returned data, the menu highlights empty or half-full minigames that the player can then select to join.

If the player chooses to join a minigame, the object data of that group is updated to fill in one of the chairs from 'N' to 'PlayerId' and status to 'waiting' to show the game is waiting on more players to join (of 'full' if they took the last free chair).

Then the client checks that the above group data contains their playerId. If not, it returns a message saying another player beat them to it. If it does contain their PlayerId, then the player joins a different group as a member along with the other players in that minigame. This second group stores all of the shared data needed for the duration of the minigame and will be read/written by just the current players in turn.

Although all players in the game can access the first set of groups, due to the way the menu system is set up, a player can only read/write them once every 30 seconds at max to prevent them spamming the server with calls to that group. And the game itself won't have a huge playerbase to begin with, so I don't think it will break call limits.

(I did have a look at the lobby system, but it didn't seem to work for all the variables I need to use - not all players can join all groups at all times).

I'm trying to work out how to set up the blueprint to read/write the group object data. Attached is the blueprint I have so far. I think I've got the right request, but what do I add in the section for 'keys' (if anything) and how to a break up the data that comes out so that it's in a usable string format? The player will have already logged into the game with their Playfab account when they make this request, so I'm guessing I don't need to add any extra authorisation per request?

Also, as a second point, I want all players in the title to be automatically added to the minigame groups (the first set with basic status info, not the specific game groups) when they create an account, to save them having to apply to join/unjoin as members every time they load the menu. What's the simplest way to do this?

Thank you : )

6195-accessgroupobjectdata.png

unrealShared Group Data
10 |1200

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

Xiao Zha avatar image
Xiao Zha answered

The way you want to use Group Object Data to store data such as game state is like Global Variables, but PlayFab Group Object Data and Title Data are not supported as Global Variables, because it may cause data conflicts when synchronous update operations occur. We suggest that you can use an external database for this functionality. In addition, Group Object Data is not the same as Shared Group Data, to get Group Object Data, you may use Object - Get Objects - REST API (PlayFab Data) | Microsoft Learn with Group Entity.

2 comments
10 |1200

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

chorustempo avatar image chorustempo commented ·

Sorry if this is a noob question, but can you clarify the difference between Group Object Data and Shared Group Data and what they might be best used for?

The Group Object Data seems to be best for a small temporary groups (for example, I wanted to use it for a mini turn-based board game with 2-4 players). But what is the Shared Group Data intended to be used for that's different?

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha chorustempo commented ·

A Group is a collection Entity that contains other Entities and use Objects and Files to store data while Shared Group Data is a way for players to share some information with a tightly constrained list of other players. Also, Group is used to create guilds, clans, corporations, companies, tribes etc. in your game which may need persistent-state while Shared Group Data is best used for turn-based game.

0 Likes 0 ·
chorustempo avatar image
chorustempo answered

Or... should I be using the Title Data KVPs for the status data strings for each minigame (one KVP for each minigame)? I just found a doc saying players can only update one KVP per request anyway, which is fine for what I'm after. The player needs to read multiple KVPs, but only update one of them.

So if I have 27 minigames in total that could possible be available to join (split into 3 game types, so the game menu will only need to read/display the results of 9 KVPs at any one time), I could create 27 KVPs on the title data. Then players can:

  • Read the KVPs for the 9 minigames they want to get the status of on the minigame menu.

  • Attempt to write to the KVP of the specific minigame they want to join.

  • Then check their PlayerId has been added to that KVP.

  • If it has (and another player hasn't beaten them to it), they can then request join the group for that minigame with the other 1-3 players active in that game.

  • The group shared data will be the source of info while the game is active.

  • Then once the game is finished, the group data gets reset and the KVP for that minigame on the title data gets reset to "GameRef": "Empty, N, N, N, N".

Would that work better? Or am I completely misunderstanding how groups/title data works?

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.