question

andreas avatar image
andreas asked

Validating a single ItemInstance in Cloud Script.

Let me get this straight (a little confused). Say I have a "rarity" value as catalog custom data for an item. When an InstanceId is sent to to CloudScript I need to:

  • Get the whole user inventory(+400 items)
  • Get the whole item catalog (+600 item definitions)
  • Parse through the whole inventory item for item to find the correct instance and ItemId
  • Then parse through the whole item catalog to find the corresponding catalog item
  • Now I can see the custom data.

Compare it with Clash Royal chest timing. You want to know how long time this specific chest will take to open (hence rarity and maybe time that it will take to unlock). You cannot send the ItemId as argument as it might be corrupt and just need to check it up inside the cloudscript.

The solution feels so heavy on the server?

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

·
Joshua Strunk avatar image
Joshua Strunk answered

The scenario you are talking about is doing linear time searches, which data structure and algorithms often give a bad rep. The fact is datasets of 1000, even 10,000, only seem large to us as humans, to a computer this is nothing. The very nature of PlayFab's data storage means someone has to do a linear search. Of course, if you are doing more than one search it could be worthwhile to transform the structure of the data you get from PlayFab.


"You cannot send the ItemId as argument as it might be corrupt and just need to check it up inside the cloudscript."

This line confuses me care to expand your thought process on this. I can only envision situations in which it would be fine to do these calculations on the client with a verification call only when attempting to open the chest.

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.

andreas avatar image andreas commented ·

Thank you for your quick answer. Yes I can see I'm being vague in the sentence. What I mean is that I need to confirm that the correct time to wait is set both on the client and server. This is then checked again when it is time to open the chest.

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.