question

robertqiu10 avatar image
robertqiu10 asked

How to use GetUserInventory

Currently in my game GetUserInventory is called every time the inventory scene is loaded, but i've been thinking lately and realized that not only would it take a small amount of time before the inventory is loaded, which can get annoying, but also if a user pressed the inventory button repeatedly and kept loading the scene at a fast rate the API calls would be throttled. I'm not a seasoned game developer or anything and don't know much about how most games handle this type of thing. I was thinking about an alternate way in which I load everything when the game is first booted, such as the inventory, currency, etc. and save them locally, and when the user edits something it makes an API call and the change is also saved locally. I don't know which way is better and was wondering if anybody has any advice. Thanks!

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

·
brendan avatar image
brendan answered

In general, you would load the player's info when you log in, and just keep it cached locally, updating as you described. So, if the player makes a purchase using receipt validation, for instance, you would re-query to make sure you have the current state.

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.