question

Muhammad Roshaan Tariq avatar image
Muhammad Roshaan Tariq asked

How to apply percentage to loot awards?

Hi, I'm designing new loot system for my game and there are some requirements which are confusing me and I'm not sure if or how I can create it on Playfab:

Requirement:

  • Player can get 2 to 3 items
  • 50% of the times 2 items
  • 50% of the times 3 items
  • For each of these items, there is should be 80% chance that they should get common items and 20% chance that they should get rare items.

Example possible drops:

  • One common, one rare
  • One common, two rares
  • Two commons, one rare
  • Two commons
  • Two rares
  • Three commons
  • Three rares

What I have done so far:

  • Created two item drop table
  • Created three item drop table
  • Created a new drop table in which I added the above two mentioned drop tables to give them 50% chance. Is this correct way to do that? [Please see attached screenshot]

And I'm not sure of the last part, how to do it on Playfab? (80% chance it is common, 20% chance it is rare.)

In-Game Economy
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

·
Seth Du avatar image
Seth Du answered

I will sum up your requirement, please correct me if I didn’t understand it properly.

  • Player will 100% get 2 items.
  • There are 50% chance to get another one item
  • The rarity of items is independent, 80% common and 20% rare.

A better workaround solution, which can be reused in many other scenarios should be:

  • Create a Drop table A, which contains Common items, the drop rate for each item is even
  • Create a Drop Table B, which contains Rare items, the drop rate for each item is even as well.
  • Create a Drop Table C, which contains Drop Table A and B, and they will have Weight 8 and 2 separately.
  • Write a Cloud Script function, where 50% chance will be calculated to determine whether the Drop Table C will be used twice, otherwise, 3 times of EvaluateRandomResultTable will be called to determine the result.

PS. It is also very recommended to add the Drop Table C into a bundle or a container, so that the Cloud Script will be able to grant the reward within one API call via GrantItemsToUser API. EvaluateRandomResultTable API call is not necessary in the function.

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

Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq commented ·

@SethDu

You got the requirements accurate and I have one question though

  • Can't we use some drop table to evaluate the 50% chance?
  • Do we have to use cloudscript for that? If yes, then how can I code it in the cloudscript? Any documentation or resource which can help me in the matter?
0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Muhammad Roshaan Tariq commented ·

The drop table will send out only one of items in the list, developers cannot determine the result number. This a very common scenario in games, for example, in the Gacha games, players will have the same quantity of rewards in one attempt of unboxing. The scenario you have described is customized, and we usually recommend using Cloud Script/Azure Function.

For more information about Cloud Script, you may find the usage on: https://docs.microsoft.com/en-us/gaming/playfab/features/automation/cloudscript/

Additonally, because PlayFab doesn't allow empty contents in Drop Table, Bundle and Container, if you insist on using Drop Table, you may consider adding a low-valued reward to replace the condition of not getting 50% chance additional item.

0 Likes 0 ·
Muhammad Roshaan Tariq avatar image Muhammad Roshaan Tariq Seth Du ♦ commented ·

@SethDu

Is there any builtin function in Playfab's cloudscript which can generate a percentage? Or do I have code that function too?

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.