question

spynorbays avatar image
spynorbays asked

What method should I use to store and update map data?

My game is multiplayer with a single map consisting of many cells with their own coordinates and variables. Those cells can be owned by players and updated when needed. (Clients will get the map information from Playfab and update it on their side once every minute or so, doesn't need to be real-time)

The problem is that I'm not sure what method should I use to store the map information in Playfab.

I have the idea of making a leaderboard of players with their owned cells and these cells' variables as the value. Then updating the corresponding leaderboard value when a player makes a change on the cell. (Then iterating through the leaderboard to get the whole map information)

That's the best idea I have on how to implement this but I'm not sure if there is a better and more optimized method.

Is there a better way of storing and updating global information like these?

Player DataTitle Datadata
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.

spynorbays avatar image spynorbays commented ·

Just realized you can't have JSON as a leaderboard value so my idea won't work; but the question is still relevant.

0 Likes 0 ·

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

If about a dozen or fewer players will share one map, you can consider using Shared Group Data and CloudScript to implement it. This document -- Using Shared Group Data - PlayFab | Microsoft Docs contains the example of the turn-based multiplayer asynchronous games. If all players of your title will share one map, as you said, it will be the global variable of the title. Currently, PlayFab doesn’t provide the feature to handle the global variables. For this case, we would suggest you use the external cache, such as the Azure Cache for Redis, to handle such global 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.

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.