question

dgupta avatar image
dgupta asked

Creating a Territory War game like like Lord's Mobile or Pokemon Go

So, we were thinking in the future of creating our own twist on the territory war genre. I was wondering if a game like this is possible with Playfab, and, if so, how could it be achieved? The main two things we would need is the ability to store the map on playfab which has details such as the names of the different territories and what they hold (like pokestops in Pokemon go), and the ability to place troops in territories after you conquer them (like placing pokemon in gyms in Pokemon Go). I'm thinking we could store the map using Playfab CDN and just have every player download it. It would give map details and possibly ids for each territory. But, the harder problem is how we can keep track of what territories are conquered. So that presents a major problem.

Updating Conquered Territories

As far as I know, there is no way to do instantaneous updates in Playfab for all players. This would present a problem especially if there are a lot of players. If a player is already within a territory, how would we make sure that no other player can enter that same territory? Also, how do we make sure the map is up to date whenever any player conquers a territory? In both of these cases, if we store it in title data then everything within the title data key would have to be updated whenever anything happens. That presents concurrency problems. Also, if we use title data that could take up to 15 minutes to sync across all players and present huge problems as not all players are guaranteed to have the updated map.

Thanks in advance for any answers! And sorry for the long question.

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

·
brendan avatar image
brendan answered

So, the two problems you need to overcome are:

a) Massive sharing of data elements - In this model, one piece of data has to be updated by potentially every player in the game (the "gym", for example).

b) Frequency of updates - At the same time, you're going to need the ability to update that single element at a high frequency.

Both of these requirements mean that the data in question must be in-memory, not on-disk. PlayFab has three data models:

1) Title data - This is a sharded and cached resource, designed for all players in the game to read from it at once, if needed. So it can only be updated periodically, and so only by the developer or publisher.

2) Player data - This is highly consistent, disk-stored table data that is associated with a single player. We also provide a version of it called "Shared Group Data" which is the same thing, just without an owning player. You can have a few players update it, but if you try to have a lot of players update it, or you try to update it at a high frequency, you'll have problems, as it's not designed for that.

3) Entity data - This is our newer data model, and in it we have Entity Objects, which are similar to profile data in that it's stored in a more efficient model where you can use it for Clan/Guild/Team data (so, groups of upwards of 100 players might share the data). It's designed to only allow for one update at a time, so multiple players trying to update it won't cause problems, though if they're simultaneous requests, only one will succeed and the others will get a "busy - try later" response.

In not really going to count CDN data at all. That's just a store for large data that you need to distribute broadly, and which is rarely updated (TTL on CDN data is at least an hour).

As you can see, none of these is something you can use for data that needs to be updated at a high rate, and by thousands (or more) of players. The type of game you describe requires custom game servers that host the state information of the world elements. You would have a number of servers running based upon how many regions you have and how many players you have in them. Those servers would enable the high frequency updates, and would periodically update the Entity data that you use as the long-term store for the data of all the things in the world.

You'll also need to have a custom matchmaker, since it will act as the coordinator of how many servers you have running per region and what world geos they "own" (and so, which Entities they're in charge of). The matchmaker would direct players between those servers based upon the reported geolocation of the user.

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.

dgupta avatar image dgupta commented ·

Ok, that makes sense. Thanks for the quick answer!

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.