question

andrzejkorolczuk avatar image
andrzejkorolczuk asked

Best practices during player's registration

Hi

In my company we're struggling to find a way to work around some PlayFab limits. What we need to do is to make multiple api calls during player registration like granting characters, creating some title data, etc. Let's say that we need to make 10 different API calls.

Couple of attempts were made and we stumbled upon 1s execution limit and/or api calls limit (while still being on Free tier, now on Pro). I wasn't involved in those tests but we ended up with client making all those calls separately which I think is a bad practice as it introduces additional error prone layer.

What is the best practice to resolve this? I was thinking of creating chain of custom events and rules executing CloudScript that correspond to them which make api calls under 1s and at the end dispatches another event if necessary. Will this work? Is there a better way?

Many Thanks

A.

CloudScriptPlayStream
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

·
Seth Du avatar image
Seth Du answered

There are many ways to do it but I believe your solution is relatively very good. Because the PlayStream event https://api.playfab.com/playstream/events/player_added_title will only be generated once when the player logins into PlayFab for the first time, which is also the perfect time for triggering rules to initialize the player account. In addition, it is safe to execute the initialization process in the Cloud Script. You are already on the right track.

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.

Andy avatar image Andy ♦♦ commented ·

In addition to what Seth advises, I would recommend against chaining together triggered cloud script through additional events. My preference would be to use a simple cloud script function triggered on player_added_title to set the most important stuff and then also a cloud script function called from the client to do some of the lower priority stuff (which would check to ensure the high-pri stuff had been done first).

Also, we're getting close to having Azure Function support for Cloud Script. This should give you an interesting alternative to working within the current limits, as it provides more flexibility with run times and API call counts.

1 Like 1 ·
andrzejkorolczuk avatar image andrzejkorolczuk commented ·

Thank you for your answers. Is there any ETA on Azure Function support?

Also considering that I'd have to chain a couple of cloud scripts - is there any way of notifying the client that the chain has finished rather than polling server every X seconds?

Same with player_added_title - as this is a playstream event - what's the smartest way of finding out if it has finished?

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.