question

Dean May avatar image
Dean May asked

Is there a way to get Limited Edition Count Available from server or client API?

I am currently attempting to use CloudScript to generate a dispersal to players in a shared group of limited edition catalog items. Based on the API docs, the only way I can get the CURRENT (not initial) limited edition availability is via the Admin API CheckLimitedEditionItemAvailability. Being that I think I read that the Admin API gets throttled more easily, and it isn't officially supported via CloudScript (though I have been able to call it like a custom http endpoint from CloudScript successfully), is there another way to get the limited edition current amount without having to call the above method once per catalog entry where IsLimitedEdition is true? I think but am not sure that the throttling may be causing issues in this CloudScript function (I have implemented polly-js to allow retries, but that probably is making matters worse if the throttling is the issue).

apisCloudScriptIn-Game Economy
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

It sounds like you may be describing something that isn't supported in Cloud Script. Bear in mind that Cloud Script has a very limited amount of CPU time and number of API endpoints you can call, so trying to use it to distribute to a non-trivial set of players is something you'd need to do from a custom game server or a script (we'll be updating to support Azure Functions later this year, so that will then be an option for longer-running scripts). But also, it is correct to say that we do not support calling Admin API endpoints from Cloud Script.

If it is a tiny set of players, what is it you want to do if there aren't enough of the item for all players to have one? If you simply try to grant the items, you would get back an error if you're attempting to grant one past its limit, so that may be the simplest way to implement this, in that case.

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

Dean May avatar image Dean May commented ·

Thanks for the feedback, Brendan.

Perhaps when I said "dispersal" it wasn't quite the right term. I want to divide up the limited edition items that are left based on the number players "online" who are in a shared group and notify each of the clients of how many of each limited edition catalog item in a certain store that they can show in game, and grant them one when they "find" it in game. I definitely will be using a custom game server so moving this out of CloudScript makes sense to me.

My issue is that I want to make sure that we aren't getting to the point of attempting a grant that will fail and disappoint a user by ensuring I'm only providing information on limited editions that are available now, not what we started with (obviously I have a buffer of a few items in place since nothing is perfectly "real-time"). I don't want to have do something separate to track availability as the limited edition functionality already does that well, but I want to be able to query that amount pretty regularly from the game server and want to make sure that won't be an issue. Is the Admin endpoint throttled more than the others, or are the API call frequency limitations similar?

0 Likes 0 ·
brendan avatar image brendan Dean May commented ·

Admin API calls are rate limited higher than Client calls, but lower than Server (since they're generally used for tools that are run at one location). You could technically use the Admin API from your server, but there's a fundamental issue with what you're describing. If you have more than one server making this call, you can wind up with each of them trying to use all of the remaining items, which would result in you being in the same situation - unable to give players what you wanted to. If you want to distribute this the way you describe, I'd use a Redis Int to track the number remaining, so that you can have the servers first subtract from that, and then grant as many items as they subtracted from the Int.

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.