question

pleasehelpme avatar image
pleasehelpme asked

Best method for bulk variable transfers to PlayFab?

Hello, I am confused about the way I would go about having bulk transfers of variables to the server.

I have an RPG type game in the making where I want to be able to store Level EXP of multiple skills (ex: Strength, Intelligence, Luck, etc.) as well as currency from in-game, premium, and premium energy. What would be the best way to go about bulk transferring these variables.

I was thinking about a local variable ex :CurrencyChange, MoneyChange, StrengthChange, etc. that would add or subtract based on whether you gained currency/skill points or spent them. So if I were to gain 5 currency, then gain 5 more, then spend 4 then my CurrencyChange variable would = 6.

After 5 minutes the game will call any [Var]Change variables that are not 0 and add currency API or subtract currency API if it was negative. Consume and purchase items are used in the case of an inventory item and work the same way as the currency. However, this can be abused if someone uninstalls the game and reinstalls it and that would delete the local variable.

Progression such as area location is always stored as they are reached. So if they reached area 5 but then deleted the app before the 5 min timer then the last 5 minutes you could lose an important item that is required for Area 5 that was found at the end of Area 4. After they reinstall, the Area 5 variable will be restored but they have lost an important item.

A good example of using too many calls would be a player does 5 or more battles in 1 minute. That would essentially result in 5 or more APIs to add EXP value to the PlayFab server. That's why I want to combine it all into 1 call. I was wondering if anyone had a better way of approaching this since that new plan change makes it so applying an API after each action no longer a viable option. Thank you.

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

·
Sarah Zhang avatar image
Sarah Zhang answered

Suppose your target is to reduce the calls of PlayFab API and at the same time, you want to ensure the data timeline and security. You can check this best practice -- Consumption Best Practices, especially Cheat Protection and Data Timeliness for the comprehensive advice.

In addition to the hosted server and Cloud Script mentioned in the documentation, you can also use the external cache to save the temporary data. Players cannot directly access the cloud cache so that it can Prevent abuse. You can use Http calls from Cloud Script to update the data. Or you can consider using Cloud Script using Azure Functions, which has better integration with other Azure database features, such as Azure Cache for Redis, Azure Cosmos DB.

10 |1200

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

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.