question

kosar avatar image
kosar asked

Syncronizing Inventory Items

I can't seem to figure out how store items can be synced between Playfab and my game. Can someone help me understand how it works on Unreal Engine blueprint.

What I want to achieve is, lets say I have a weapon that a player can buy from the store. How can I sync this weapon between player inventory on play fab and the game?

Would appreciate any help

Player Inventory
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.

kosar avatar image kosar commented ·

Just for reference, I can retrieve store items and let player buy them. Storing these weapon on the player inventory is what I am after

0 Likes 0 ·

1 Answer

·
Seth Du avatar image
Seth Du answered

The basic idea is every important action that a player does to the inventory (for example, consume, delete, purchase...) will trigger the sync. The online data that is stored on PlayFab server will be retrieved and replace the local data on client app.

First, when the player login successfully, the client will sync the player inventory and save that data locally.

The purchase process should be done on Cloud Script (or some external secure server). After the client receives the successful callback, another sync will be triggered so that it will keep player’s inventory up-to-date. The data on PlayFab always has the highest priority and it will simply replace the local data.

If player consumes or deletes an item, after the successful callback, you can request for a sync again.

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

kosar avatar image kosar commented ·

Thanks for the answer. This is the logical side of the operation which Im familiar with. What I meant is, how can I populate the player inventory the next time they login to the game from the client's end. I currently implemented a shop where player can purchase things and everything works perfectly. But upon restarting the game, the item is still in the player's inventory on Playfab but but on on the client's end. So I want to also retrieve those items back to the player's inventory too using Blueprint.

Hope that clarified a bit more

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ kosar commented ·

So you have confirmed that items that the player purchased have been saved on PlayFab and you can see them on Game Manager, but after restarting the game, you cannot see those items on your client. Is it your issue?

0 Likes 0 ·
kosar avatar image kosar Seth Du ♦ commented ·

I meant all client side.

Let me use a different approach. Here I am looking at a player's inventory. Im checking if they have the mentioned weapon, if yes then place that weapon in their local inventory. Now imagine if I have 50 items. This can become very chaotic and alot of api calls.Is there a simpler way that I can just place the playfab inventory items into the local inventory without going through this?

0 Likes 0 ·
2.png (209.8 KiB)
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.