question

oriolperarnau avatar image
oriolperarnau asked

PlayFab Economy V2 doubts

Hi!,

We develop Idle RPG games, we have already developed and published one game using PlayFab V1 Economy. Right now we're working on a second game and we have some doubts about Economy V2. We've tried to search similar questions but they don't answer the specific details.

Before asking the questions, here is a list of "economy entities" that our game will manage and how many of those as context.

First the list of what we think it could be a currency because they are not unique:

  • Classic soft and hard currencies (gold, gems, tickets). 10+

  • Character orbs for upgrading characters. 30+

  • Character shards for improving character ranks. 30+

  • Materials for upgrading characters equipment. 200+

  • Skill resources for upgrading characters skills. 4+

  • XP consumables for leveling up characters. 4+

  • XP points for Player globals (level, rank,...). 4+

Second the list of items because they are unique and only one can be granted to the user:

  • Characters. 30+

  • Avatars. 30+

  • Character Skins. 205+

In total more than 500 items. We'll be adding more as the game evolves, but we think it's really important to have a clear understanding of the economy systems right now to pick the right solutions.

  1. What is now the difference between an Item and a Currency? It looks like they work the same way now under the hood, as you can stack both currencies and items. We don't know if there is any advantage in choosing one type over the other for each economic entity now.

  2. The Catalog and the Inventory use has changed. In V1 we used to retrieve the full catalog and the full inventory in CloudScript, to process some items and maybe grab more data and give it all back to the player client. But right now, you can only retrieve both the inventory and catalog in chunks of 50 items with SearchItems, GetItems and GetInventoryItems. That would mean more than 10 requests for the catalog and potentially the same for the player inventory once they gather every different type of item in the game.

We'd be lookin at more than 20 requests for retrieving just the catalog and inventory every time the game starts. I don't know if it is intended to be used this way, but this raises some questions like maybe we should use other systems like TitleData + UserData to store some items and the amount for them that the player has, because you could read it all from a couple keys in a couple requests instead of 20. We'd appreciate it if you could explain in detail what we should be doing in this scenario, taking into account best practices.

  1. Regarding the previous questions, we have doubts about the Economy API limits.

Let's say we go ahead and put everything in the catalog. By reading the documentation there is a limit for the Player (100 requests in 60 seconds) and for the Title(10.000 in 10 seconds).

Please correct me if I’m wrong, but we understand that if we use the PlayFab Unity SDK for SearchItems and GetInventoryItems, Player limits will apply. But what about if I perform the same request from Azure Functions, the Player limits can be targeted instead of the Title limits? We are asking because if there is a limit of 10.000 in 10 seconds for the Title, in a game with a lot of concurrent users (we have around 10K DAU in the other game), 20+ requests per user could potentially hit that limit. Around 500 players starting the game in less than 10 seconds doesn't sound crazy, especially during launch days.

This also makes us think about if it's a better idea to move some items outside of the catalog or inventory (specially those that will only be granted once and will never be removed,or modified), just to reduce the number of requests. Less requests should mean less risk of hitting the limits and faster loading times.

Any advice on how to approach these problems will be highly appreciated.

Thank you very much!!

apisIn-Game EconomyPlayer Inventory
10 |1200

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

Gosen Gao avatar image
Gosen Gao answered

What is now the difference between an Item and a Currency?

In Economy v2, Currency is also an item. Different item types make it easier to search for corresponding items.

You can only retrieve both the inventory and catalog in chunks of 50 items with SearchItems, GetItems and GetInventoryItems.

Yes, in v2, players can only obtain catalog items and inventory items in batches. For catalog items, we recommend caching all the catalog items locally, and only refresh it when there are updates. For inventory items, we recommend displaying them in categories and pages. And only get inventory items when needed.

Regarding the previous questions, we have doubts about the Economy API limits.

For requests from server or Azure Function, there is no need to fetch the catalog separately for every player action, cache it and update it when needed. As for inventory, as the docs mentioned,

  • Limit (Player) refers to when the entity being targeted is a Player.

  • Limit (Title) refers to when the entity being targeted is a Title.

  • Inventory throttling will be calculated based on the target entity, individually for each API.

For example, if a Player or a Title (game service, coudscript, etc.) calls an Inventory API to update/get the Player entity's inventory, the Limit (Player) throttling will be applied. So as a Title, you can call GetInventoryItems 100 times in 60 seconds for each player.

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.

oriolperarnau avatar image oriolperarnau commented ·

Thank you for your answer!

Caching the catalog sounds like the way to go. I've been looking around the documentation but I cannot find any information related to Catalog versioning, or how to know when the Catalog has changed to clear the cache and read the data again.

Do you have an example of what is the best way to do that both in Azure Functions and Unity?

I think that one work around could be to add the Catalog version to a TitleData key, and update it every time we change something in the Catalog. This way both Azure Functions and Unity client could read that key to know if they need to update the catalog.

Regarding the Limits

Your example makes it very clear that GetInventoryItems will target the Limit(Player). But what about the SearchItems call? Could you please give me the same example information but with SearchItems?

0 Likes 0 ·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

We'd be looking at more than 20 requests for retrieving just the catalog and inventory every time the game starts.

We know this is a common problem for developers on Economy V2 and plan to release features soon to make this much easier. Our goal is about 1 call for catalog and inventory each on startup.

Less requests should mean less risk of hitting the limits and faster loading times

While it's always a good idea to evaluate the cost of requests to a service, our goal is to mostly eliminate limits, throttling, and paging from the equation. We hope to address both of the issues you mentioned in our next release.

10 |1200

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

Neils Shi avatar image
Neils Shi answered

Yes, you can store the catalog version in the title data, so that the player can determine if the previously cached catalog needs to be updated via checking the title data. You can set the login API’s parameter “InfoRequestParameters – GetTitleData” as true so that every time the players log in, they can check the current catalog version. But please note that since the title data is best suited for Global Constant/Static Data (the title data values are copied and distributed to potentially hundreds of machines in the PlayFab server cluster. As part of this process, title data is cached, and changes may take up to fifteen minutes to refresh in those caches), so, if your catalog version needs to be updated very frequently, then using title data may not be appropriate. About the API SearchItems, its limitations depend on whether the entity being targeted is the player or the title. For example, if a Player or a Title (game service, coudscript, etc.) calls the API SearchItems with the player Entity (the entity to perform this action on), then the Limit (Player) throttling will be applied.

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.