Idea

dragonfoundry avatar image
dragonfoundry suggested

Crafting: Disenchant multiple items

We've built a craft/disenchant system using stackable items. Each item is a bundle containing the disenchant price, and has a cost equal to the craft price. Pretty simple, and effective. However, I'm noticing some areas where such a system could cause an unusually high number of PlayFab calls.

The biggest case (which we really can't offer until there's a call that supports it) is "mass disenchant of all items over the deck limit". This is because there's no "consume" or "remove" item call that operates on multiple item instances. A more effective system would be one that could pass a list of itemids (not instance ids, ideall) to remove/consume.

The other case is a player deciding to manually disenchant a large portion of their collection. This will generate a large number of calls in a short amount of time (We can mitigate by gating on the client, but this creates a poor player experience). Being able to batch calls here would allow a smoother flow (with the ability to "undo" decisions, rather than force a confirmation window.

(disenchant/consume/revoke stackable items based on itemid would be valuable, as it means we don't need to worry about the item instance at all, since we can already grant items by itemId)

10 |1200

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

5 Comments

·
brendan avatar image
brendan commented

Thanks! So to be clear (for our backlog item), you're seeing this as a call that takes an array of ItemId/Count pairs, so that the logic goes through and removes the specified count of all the items listed. In the case where one or more of the items doesn't have enough of the item listed, presumably you would expect the entire operation to fail and nothing to be consumed, correct?

10 |1200

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

dragonfoundry avatar image
dragonfoundry commented

Exactly that. Or a list of ItemIds (allowing duplicates). Ideally, an option flag for "do as much as you can" and "fail if you can't do anything", but that's not vital - either being the default would work.

10 |1200

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

mike avatar image
mike commented

+1 for this request. I would imagine an overloaded method call for ConsumeItem that takes an array instead of just one item. Or just call it ConsumeItems.

Another use case for this is when you're equipping a bunch of power-ups or boosts before a gameplay session... you want to consume all the items at once as soon as the session starts.

10 |1200

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

mike avatar image
mike commented

FYI, for now I'm doing this using CloudScript (to limit the number of internet requests) like this:

handlers.ConsumeCards = function (args)
{
  for (var id in args.cards)
  {
    var ConsumeRequest = {
      "PlayFabId" : currentPlayerId,
      "ItemInstanceId": id,
      "ConsumeCount": parseInt(args.cards[id])
    };
    var ConsumeRequestResult = server.ConsumeItem(ConsumeRequest);
  }
  return "success";
}

With this on the Unity side:

// This is just an example, but the idea is to create a dictionary of InstanceIds and consume counts:
Dictionary<string, int> consumeData = new Dictionary<string, int>()
{
  {"57AF1EB9DC6836EF", 1},
  {"BD5091B722892D38", 1}
};

ExecuteCloudScriptRequest request = new ExecuteCloudScriptRequest() { 
  FunctionName = "ConsumeCards",
  FunctionParameter = new {
    cards = consumeData
  }
};
PlayFabClientAPI.ExecuteCloudScript(request, ConsumeCardsCallback, OnApiCallError);  
10 |1200

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

marcos avatar image
marcos commented

Hello there, just checking, there is still no official batched operation for consuming items?

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.

brendan avatar image brendan commented ·

As shown in the roadmap (https://blog.playfab.com/blog/playfab-roadmap-update), we'll be releasing the new commerce service in the first half of 2020. The legacy service is not planned to be updated, and will eventually be deprecated (so, it'll continue to work for all titles using it, but eventually we will remove it from the SDK and docs).

1 Like 1 ·
marcos avatar image marcos brendan commented ·

Thank you!

0 Likes 0 ·
pixelsage avatar image pixelsage brendan commented ·

I noticed that there's no mention of an updated commerce service in the latest update. Should we proceed as if this is not planned for the first half of 2020? Thanks!

0 Likes 0 ·
duartedd avatar image duartedd pixelsage commented ·

Hey Whats to stop us from using revoke inventory items? rather then consume? then once thats completed and returned - call the grant items api?

0 Likes 0 ·

Write a Comment

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

Your Opinion Counts

Share your great idea, or help out by voting for other people's ideas.

Related Ideas