question

mfortin avatar image
mfortin asked

UnlockContainerInstance timing out,UnlockContainerInstance time out issue

Greetings. Our game features unlockable containers that give lots of items to our players.

I am using a cloud script to unlock one of such containers for a player, using the method called "UnlockContainerInstance". Some of those containers contain large numbers of drop tables. I suspect this is causing the "UnlockContainerInstance" request to time out, when called from a cloud script. The same code performed well when giving a container with relatively few items, but an error occurred when opening a container with many items. Is it possible that if I give, say, 20 instances of a DropTable, it causes 20 "hidden" API calls to be made in order to randomly determine which exact item is given? That would dramatically increase the execution time of the cloud script, even though I am only making a single API call.

For reference, my App Id is A70F; I am successfully giving a container called "RewardSmallTier1Level1" (about 16 drop tables), but timing out when giving "RewardHugeTier1Level1"(about 170 drop tables).

Looking at my Event History, the error is:

{
                "Level": "Error",
                "Message": "PlayFab API request failure",
                "Data": {
                    "api": "/Server/UnlockContainerInstance",
                    "request": {
                        "CatalogVersion": "Equipment & Cards",
                        "ContainerItemInstanceId": "FB788ED0C5875EE3",
                        "KeyItemInstanceId": "3C55E295867D0916",
                        "PlayFabId": "722CAC50022BC141"
                    },
                    "error": "Timeout"
                }
            }

If my hypothesis is correct, are there any workarounds for this issue?

Thank you for your support.

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

mfortin avatar image mfortin commented ·

Weird, it seems I double-posted my question after having to sign-in. Sorry.

0 Likes 0 ·
mfortin avatar image mfortin commented ·

Many thanks. We will try a way to re-organize the bundles and drop tables to achieve the same effect with fewer items.

Thank you for your support.

0 Likes 0 ·

1 Answer

·
1807605288 avatar image
1807605288 answered

I can corroborate your findings that there are performance issues with inventory when large numbers of items are involved. (In fact, ALL inventory operations with large numbers of items). This is something we're actively addressing, but I don't have an ETA for you. I suspect that it won't be soon enough for your needs.

Since you're exceeding the Cloud Script timeouts, then Cloud Script is probably not going to work for you.

Some alternate options:

  • Stagger the operations, client side
    • What I mean by this, is make the user/client perform multiple API calls, and split up the work. If these are nested "containers/bundles", then make one "big ultra chest" drop another chest, which they manually open as a separate operation.
    • Or just stagger the client calls to open the containers one at a time, on a 5 second delay.
  • That's a lot of drop tables...
    • One operation triggering 170 drop tables is... quite significant. I'm sure there is a game-design reason you've went this way, but... you're really taxing the system too hard. If you flatten or re-organize your drop tables, you can probably achieve a similar result.
  • Game Servers
    • It involves extra hosting cost for you, but you can do all this work on your own game server
    • You can do the "flattening/evaluation" part of your tables more optimally than we can
      • We have to solve the extremely generic case, and sometimes that means more overhead
    • https://api.playfab.com/documentation/server/method/GetRandomResultTables
    • You can download the table, and evaluate the awarded items for a 170 long chain of drop tables locally on a game server. Once you have the final list of items, you can use a single inventory operation to grant the final item list:
    • https://api.playfab.com/documentation/server/method/GrantItemsToUser
    • Evaluating a huge chain of drop tables like this, for us, just requires the FULL sequence of inventory operations. (grant, evaluate, stack, unpack, grant, evaluate, stack, unpack... etc) We can't shortcut it, because we have to handle every edge case. You can shortcut it in whatever way makes sense for your game, and is more optimal for your specific circumstances.
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.

brendan avatar image brendan commented ·

Update: Our current target is to have the updated inventory system complete by the end of Q3. We'll be publishing a high-level view of our roadmap on the site shortly.

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.