question

adoyon avatar image
adoyon asked

Using Custom Data on item

Hi!

I am afraid I'm doing the wrong architecture and will end up sending way too many requests to playfab.

In short:

1) Players make an action (ex: killing a monster)

2) I grant a bundle via a drop table

3) If item type debuff is dropped, I add a custom data on it. (Ex: Specify class spell being affected by the debuff)

4) I have to reload the player's inventory to keep track of the debuff.

I have a total of 8 generics debuff that can be tagged with 100+ differents custom values. My current process:

1) Unity calls a cloud script that grants the bundle. (Since I cannot grant using the client API)

2) Unity reloads the player's inventory. Sometimes it takes two calls and more before it shows up in the inventory. It is sad that the Grant bundle successful confirmation is given even if the item from the bundle is not yet added to the player inventory.

3) Unity calls a cloud script to update the item custom data. (Since I cannot edit custom data using the client API)

4) I make one final call to reload the players inventory from Unity.

So if I have 200 000 game sessions that get a debuff, I have to make a minimum of 4 calls via two cloud scripts. (800 000 calls !)

I am doing something wrong for sure. :) Can you help?

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

1 Answer

·
brendan avatar image
brendan answered

Well first, what is the frequency with which this occurs in the game and what are the player inventory sizes? If this is only occasional (every couple of minutes), then clearly, it's not an issue. If, however, this could occur multiple times per minute, we'll need to get more details on your game to determine the best approach.

As to having to re-load the inventory after a Grant, if you are waiting on the results of the Grant operation before querying for the inventory on the client, the items should already be there, as the items are added synchronously in that call. If that's not what you're seeing, we'll need the specifics of your repro, so that we can look into that (the actual call sequence, and the items/players used for testing).

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.

adoyon avatar image adoyon commented ·

Wow, even during the weekend... You'r a trooper! :) You guys have an insane customer services.

So yeah, when I grant a bundle, playfab return a result but all the item are not yet added. This happen more on bundle with 6 to 10 items. So we get incomplete inventory. I could probably send you the exact bundle and API call to reproduce the issues.

As for the scenario I just described, it does happen often per game session. If it would have been possible to write custom data when I grant the item at the same time, everything could have been done in one cloud script and reduce drastically the number of requests.

The problem is really:

- A call for the drop table

- A call to grant the item

- A call to add custom value

- A call to refresh the inventory

0 Likes 0 ·
brendan avatar image brendan adoyon commented ·

So to be clear, are you making one grant call, adding all the items, and then one call to update the custom data on an item? If not, can you clarify the call sequence and frequency? The reason I'm pushing on this is because player inventory updates, if they're frequent, result in a "hot hash" issue, which slows down responsiveness on the table (which could in turn be part of the problem). Also, how many items are already in the player inventory in your test? The size of the inventory also can impact performance at larger numbers.

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.