question

max avatar image
max asked

Where to save single match data?

In my game the players compete in 1v1 matches and I'm currently wondering where I would save the results of all matches ever played and the full match replay data.

1) Would it be possible to create a Shared Group for every match ever played and save the match data there?

2) When using Shared Groups, I've read that all players added to the group can write data to it, hence I think I could not add the players the normal way, but save them to a key/value. Then I would save the shared group IDs to the players' data to remember which matches the players participated in. Is that correct?

3) Is there a limit how many Shared Groups I can create? I only found limits about how much data can be saved in the groups.

4) If I upgrade the Shared Groups Data, I could not only save the outcome of matches, but also the complete match replay in a group. I would like to analyze that data on my local machine to adjust the game's balancing. The question here is: Is there a way to download all Shared Groups Data?

Player DataShared Group Datagame managerMatchmaking
10 |1200

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

brendan avatar image
brendan answered

Shared Group Data was provided as a result of specific requests for a generic data space that wasn't player-specific, where a small number of players could share some info. As with anything else, it is not unlimited, since there would be no way for us to afford offering a free tier if that were the case. Specific to your questions:

1 and 3 are really the same question, effectively. The answer is that if you need more than 10 Shared Group Data IDs per player (so, since each game has two players in your model, that would mean you could have info stored on 20 games per player), please email your requirements to us at devrel@playfab.com so that we can work with you on pricing for your data needs.

For 2, that's one way to approach this, yes. And since you're talking about saving an indeterminate number of them per player, it would be best to have a record in each player account for the Shared Group Data IDs that store their games, yes.

For 4, no, not in our shared service. In addition to it not being cost-effective, as it would be scraping data from the table for potentially millions of records at a time, we cannot allow any one title to perform an operation which could cause database access issues for other titles. That's why we don't provide open database query against our core service databases. Developers with a private PlayFab instance can have more direct database access, but we would still advise against doing this, as it could impact response times to users. For local analysis of your title, whether for game match data or anything else, you should use events to track on that data, and either use an integrated analytics partner or your own S3 bucket linked to PlayStream for storage, so that you can evaluate that information.

10 |1200

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

max avatar image
max answered

Thanks for your answer!

Okay, so for the first time I got an idea about how I could save my match data on PlayFab, so players can still access it. My current estimation is that saving a full match takes a maximum of 5000 bytes. Hence, I'd probably need the Shared Group upgrade (though 100k bytes is also a bit too much ;) ).

1) Is there any better way to do this in PlayFab than Shared Groups?

2) About saving and accessing the data: As far as I understood I would create a new player event once a match is over (https://api.playfab.com/Documentation/Client/method/WritePlayerEvent). Then this event would get piped into my own S3 bucket. Is that correct?

3) I've seen that events have a maximum size of 1024 bytes, though the events that I'd pipe into my own S3 bucket would have a maximum size of 5000 bytes. Do I miss something here? What's the solution for this?

4) I have also checked the analytics partners but they seem to be rather expensive, I guess my own S3 bucket would be way cheaper here. Which S3 region would I have to use ideally?

5) When sending the events to my own S3 bucket, will the single events sent one by one or as a big chunk from time to time? Also will the single events be saved as single json files on my S3 bucket or will it be a single file per day?

10 |1200

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

brendan avatar image
brendan answered

Shared Group Data is indeed one way to do this, though again (to be clear), it's intended to be used the same way player data is - you can update it frequently, and multiple players can access it, but it is not designed to be used like Title Data (read by all users), as it's not a sharded/cached resource.

For your new questions:

1. That depends entirely upon the requirements. If Shared Group Data doesn't meet your requirements, you could use your own database, integrated via Cloud Script, or we could discuss a custom development contract for something more suited to your needs.

2. Yes, All PlayStream events will be piped to your S3 bucket, if you have configured that in PlayStream.

3. In order for PlayStream to operate efficiently, we do have to restrict the maximum event size. If your design requires larger events, please email the specifics to us at devrel@playfab.com so that we can discuss whether we can support your specific scenario and what the upgrade cost would be to do so.

4. You can use any region you like for your own S3 bucket, as long as it can be reached from the main PlayFab service (so, if you're using the core, shared service, from AWS USWest - which would mean that we cannot write from there to AWS Beijing). A private instance of PlayFab can operate in any region you need, however.

5. We batch update the events to your S3 bucket for performance reasons, with each batch being a distinct JSON stream file. These batches are very short (currently around 10 seconds, but please be aware that this could change over time).

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.