question

Ahmad avatar image
Ahmad asked

Authorize certain player actions using playfab

Hello everyone , I hope you are all doing great

I have a system I need to implement in game and I'm in a stalemate on how to implement it and make Playfab authorize it

we have different characters , each character have 11 permanent upgrades , each upgrade have different 5 levels , each level has a different cost , those upgrades are purchasable using a VC earned in game , so if we have 12 different characters

-a player would need to have 660 item in his 1,500 items limit ( limit by playfab ) for those upgrades only , and we will add more characters

- we can only have 3,000 items in the in the store ( limit by playfab )

- if we make it that the 5 levels are the same item but stackable, then we wont be able to change the price per level

i need suggestions on how this should be implemented in playfab and store it in the player data , especially that those upgrades are bought from the game mainmenu before he connects to the server so i dont really know if he could tamper with anything if i just use (subtract VC) for him to buy those upgrades, because the normal item buying , playfab makes sure that the price the player is paying is correct on their side

any suggestions , help , tips are appreciated

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

Rick Chen avatar image
Rick Chen answered

It is up to you to decide how to implement it. Since 660 items don’t exceed the limit, you can create that many amount of items for each character-upgrade-level. Or you can write the prices information on item’s custom data, and use the server APIs to charge the players and update their read-only data. For example, you can create an item for Character1, and to save space you can write the custom data as

"CustomData": {

"00": 300,

"01": 200,

…,

“B4”: 700

}

Where the keys are hex-code, first byte of the key “0-B” represents upgrades, second byte “0-4” represents levels, and the value represents price.

Then you can use Azure Function Cloud Script to validate the user’s purchase (checking their current value and if they have enough VC), then get the item’s custom data, and subtract the user’s VC and update the user read-only data.

The client can get the item’s custom data to display in UI, and they can get their read-only data, but cannot tamper it.

If you have any further question, you can let us know.

10 |1200

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