question

Thiago Lopes Rosa avatar image
Thiago Lopes Rosa asked

What is the best approach to handle thousands of inventory items?

We are developing a game which uses collectible cards in order to upgrade the weapons/units from the game. The same system used on a lot of games nowadays (i.e. Clash Royale, etc). The player's inventory might have a few thousand cards after playing for a while and the player might win a few hundred cards at once occasionally.

We are using "stackable" inventory items to hold the quantities for each card.

The problem is that to grant 100 cards, it takes around 8s (even using the PlayFabClientAPI.StartPurchase API with 100 as quantity, apparently the server purchases one by one). We could use the CustomData to store the quantity, but we would lose a lot of benefits (purchase, grant, open container, bundles, currency, etc), we would need to do everything manually via cloudscript.

So my question is, what is the best approach to handle thousands of inventory items?

sdks
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

Actually, the only way an item grant with quantity set to 100 would take that long is if the item is not set as stackable. Can you provide your Title ID, so that we can have a look at the configuration? Also, what is the Catalog Version you're using, and the Item ID from your test?

4 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.

Thiago Lopes Rosa avatar image Thiago Lopes Rosa commented ·

Title ID: 3062, Catalog: "Cards", Item ID: "Ghost"

My tests here show:

PlayFabClientAPI.StartPurchase with item "Ghost" and quantity "1" = 2.7s

PlayFabClientAPI.StartPurchase with item "Ghost" and quantity "25" = 3.8s

PlayFabClientAPI.StartPurchase with item "Ghost" and quantity "100" = 7.8s

0 Likes 0 ·
Andy avatar image Andy ♦♦ Thiago Lopes Rosa commented ·

It looks like you're trying to workaround the item quantity limit on the StartPurchase flow by adding 100 instances of the same item. This is resulting in us resolving 100 item purchases. As you've found, that's the wrong approach.

The answer right now is bundles. Players would buy bundles of 100 cards, not 100 distinct cards. Is that workable for your title?

0 Likes 0 ·
Thiago Lopes Rosa avatar image Thiago Lopes Rosa Andy ♦♦ commented ·

Not really, for the "100 items" case I'm adding it 4 times with a 25 quantity.

0 Likes 0 ·
Show more comments

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.