question

Amar avatar image
Amar asked

Item consumable times must be greater than 2 seconds?

HI, I just got a news updates saying that "all item consumable times must be greater than 2 sec".

Currently, all my consumable items with time are with a time of 1sec. The purpose of this is to make sure the totals are added or removed to players currency and inventory, as soon as a ClientAPI calls PurchaseItem (WithItemID, CatalogID, StoreID, Price etc..)

I am uses this as a way to update the totals on the server, and call the pull the player's inventory as soon as I get the response for the PurchaseItem successful.

The assumption is that the server updates the totals in 1 sec, and when the next call is sent for an update inventory and virtual currency, all values reflect the purchase transaction.

Now with the new condition of "Item consumable times must be greater than 2 sec", I am not be able to use the second call right away, and have to block the client for 3 seconds, before I make the get updated inventory call.

This would be a bad user experience, and how do I guarantee if the inventory is up-to date, if I change my time to 2 or 3 sec on the server?

Q: I am I using the combination of PurchaseItem for a consumable, followed by GetCombinedData(Inventory) on Success correctly?

Q: How do I ensure that the PurchaseItem transaction on the server has update the inventory items and VC, before I pull the invenotry again?

-Thanks

In-Game EconomyPlayer 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

The full context on this is that when we created consumable items in our catalog to start, we didn't apply any restrictions to the usage period (duration) - and to be clear, there still isn't a restriction, technically, as you can set up a catalog with items that have a one second expiration time via the Admin API calls. This is specifically so that we do not cause a breaking change to the service.

However, what we found some time back was that with an expiration time of one second, there were some corner cases that would show up when adding many items to large inventories - specifically, that the item could expire before the operation was complete, which could cause a number of issues. I've posted a number of times to various forum threads to advise against using a one second expiration time, but since we were continuing to see people running into this, we took the step of making the Game Manager not accept anything under 3 seconds.

So it's still possible for you to set up a 1 or 2 second expiration, but I would advise against it.

In answer to your specific questions:

The player inventory is up-to-date with any items added as soon as you get the response from the call to grant or purchase items.

It's fine to call GetCombinedData right after a call to PurchaseItem, but it's actually not necessary. We return all the information on items added to the inventory for both purchase and grant calls. We will be adding VC balance changes to that soon, as well.

Can you clarify why the item not being gone would have an impact, though? You know from the Catalog that the item in question expires, so why not just ignore it in your logic for processing the inventory?

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

Amar avatar image Amar commented ·

My understanding is that it the item is a Bundle, that holds 3 other items. And if this bundle might have been successfully added to to the players inventory.. The continents of a consumable bundle will be added to players inventory upon consumption, in this upon expiry on the item/bundle.

If this is not the case, then I have nothing to worry. Look like my assumption is not correct. The expiry of an item is nothing to do with the consumption of a consumable item or a bundle.

The edge case you are talking seems to be an issues when some one tries to add too many items to the inventory while it is older items are still active in the inventory, which are not a stackable object ? - Not the case I am shooting for. (I don't expect or want users to shoot API calls in under 3 sec..)

This clears my concern of how to use consumable items of a catalog, in combination with PurchaseItem API call.

Thanks for the clarification.

0 Likes 0 ·
brendan avatar image brendan ♦♦ Amar commented ·

Correct, a bundle is an item that comes with other items - as soon as the bundle is added, the other items are added. No consumption or expiration needed.

And for completeness, container is an item that has other items inside it, which are added when the container is opened (via UnlockContainer). When a container is opened, its use count is decremented by one, if it has a use count.

1 Like 1 ·
haoshi avatar image haoshi commented ·

2019 now, it seems the modified currencies are still not in?

0 Likes 0 ·

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]