question

ivan-ivan avatar image
ivan-ivan asked

Referral system by code in the game.

Hello! In my game, I want to make something like a referral system: assign each player a personal code, and every time someone uses someone else's code, the owner of the code will receive coins.

Can I do it with Playfab tools?

Let's assume the following algorithm of actions:

1) I give out a personal code to each player when they first enter the game: I need to make a request to the Playfab database from the client side to get a list of all codes to avoid a match when generating a new code. Then send the new code of the new player to his profile on Playfab.

2) When someone uses someone else's code, I have to go back to the Playfab database to find out if such a code exists and if so, to which player it belongs. After that, I need to issue the required amount of coins to the owner of the code.

3) At the same time, I need to block the players from using any codes several times - each player can use someone's code only once and get coins for it. But others can use the player's code an unlimited number of times and for each use he will receive coins.

Please tell me, did I present the algorithm of actions correctly? Tell me, what tools can I implement this? In particular, how can I search through the codes of all players or are there any other Playfab tools to make my task easier?

I hope for your answer.

Thank you!

Player DataIn-Game EconomyPlayer Inventorygame manager
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

·
Xiao Zha avatar image
Xiao Zha answered

According to your description, the referral system can be implement with Player Data. You can use PlayFab Id as personal code. Here is a sample you can reference.

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]