question

taikasika avatar image
taikasika asked

Economy v2 batch operations thoughts

I've been wondering about the effectiveness of the new Economy v2 batch operations, since I'm still not sure if switching is worth it for me right now.

I imagine the batch operations were planned to reduce the amount of API calls used, however, the limit of 1 on AddInventoryItems, 1 on EconomyDeleteInventoryItems and 5 operations on ExecuteInventoryOperations makes this a downgrade from Economy v1.

If we imagine a RPG, which Economy v2 seems to be suited towards, we can compare two outcomes with an identical situation ingame. Since one of the key points of Economy v2 is the ability to create large inventories, I feel like inventory management is just as important.

So, let's imagine you log in, pick up 5 different non-stackable items, delete 5 irrelevant items/stacks you already had and consume from 3 different stacks of potions. From the standpoint of Economy v2, you could do this in 3 API calls using ExecuteInventoryOperations, and from the standpoint of Economy v1, you would have to do 5.

However, something like this could happen repeatedly in the span of minutes, depending on how much loot is available for the player in a grind-like setting. If we imagine the same situation with adding 50 non-stackable items, deleting 50 different items/stacks and consuming from 3 different stacks of potions, you would have to do 21 API calls with Economy v2 and you still have to only do 5 with Economy v1. What Economy v2 does better in this situation is the weakness of Economy V1, which is that you can only consume from 1 stack at a time, but at the same time, the deletion and addition of items now has this same problem.

Before, you could add or revoke an unlimited number of items with their custom data using GrantItemsToUsers and RevokeInventoryItems, so you could send the request occasionally while not wasting too many API calls. If you didn't want to waste API calls on consuming 1 stack at a time, you could have a max stack limit of 1 on potions and add them to the unlimited revoke list for example.

If I am understanding this correctly and haven't completely misread the Economy v2 documentation, I feel like Economy v2 is wasting a lot more API calls than Economy v1 in a game with a large amount of items being moved in your inventory.

Player DataapisPlayer 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.

Xiao Zha avatar image
Xiao Zha answered

Thanks for sharing, if you want the Economy V2 batch operation become more efficient when deal with a large number of items, please feel free to post a feature request.

10 |1200

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

kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

This is great feedback. Would it be reasonable to interpret your feedback as "the max batch size limit should be higher"? The transactional design of V2 is foundational, so the system won't ever have "unlimited" requests. The imbalance between V1 and V2 you laid out above is always going to exist to some degree. What would you consider a good value for max batch operations?

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.

taikasika avatar image taikasika commented ·

Hey, that works but it's difficult to say an exact number which would be good. Game developers must conform to the system, so with the current system of limited batches, the inventory can't have many unstackable items for optimization purposes. It's not a problem to make most items stackable in PlayFab and separate in game, but for the sake of equipment and unique items, any increase in the batch size limit would be greatly beneficial.

The more items there are in the game, the more items mobs will be dropping. It's easier to create increasingly bigger loot tables than creating a new mob with a unique loot table. Without collecting statistics, we can only speculate the number of items a player gathers on average in combat. This can, however, be mitigated with weight limits and/or inventory size limits in-game, but for the purpose of having a large inventory, there will be problems with any game that has a large assortment of unique items that can be gathered relatively quickly. Even just doubling the batch operations would be greatly helpful, as it effectively halves the amount of API calls needed with a large amount of items gathered. The more batch operations possible, the better.

3 Likes 3 ·

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.