question

afroninjamx avatar image
afroninjamx asked

Cloudscript limits? | Can I link two frictionless logins?

After a bit of research I saw that Cloudscripts have a limit of 5s execution time. (as of 2016)

Is this still the case? Are there any other limits? Total lines of cloudscript? Number of cloudscript files? Cloudscript requests per user? I know that CS shouldn't be called frequently (as in per second, frame, etc).

Can I connect to my own backend service from cloudscript? Let's say I want Playfab to be the main BaaS for my game. But after running a cloudscript to access your api, is it feasible to offload a heavy computation to my own server (like an AWS instance) if need be?

Lastly, can I link frictionless logins together? It looks like the first device login should always be frictionless (which is great). But after that it seems like the way to link accounts is by providing 3rd party logins- like twitch or facebook. But is it possible for the first device to just generate a "link" code that the second device can use to connect with?

Thanks for your time!

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

afroninjamx avatar image afroninjamx commented ·

Hey- sorry guys, I tried to ask this in the middle of signing up for an account. I thought I lost my original post, so I wrote a second one. When I finished, the two were combined together into one (?) looking for a way to edit it.

0 Likes 0 ·
brendan avatar image brendan afroninjamx commented ·

I fixed it, no worries. From what the AnswerHub folks have said, their major UX update (hopefully in 2018Q1 will fix this).

0 Likes 0 ·

1 Answer

·
brendan avatar image
brendan answered

So, in order:

The limits for Cloud Script (and other things) are available in the Settings->Limits tab of your game. In addition to the max CPU time limit, there's also a max number of Server API calls that can be made, and a max bytes of Cloud Script per revision.

For calling out to your server, it's technically possible, but I'm not quite clear on what your intended logic flow is. You can make Web API calls to external services from Cloud Script via http.request. If you need something more complex, your best bet would be to simply have that logic on your own server, and have the client call it directly. You can then use the Server API from your server to do validation on user sign-in state, player data, statistics, etc.

For linking to a PlayFab account, you need to be signed into that account. So for linking to an account from two different devices, there does have to be some way to have the player signed in on the second device in order to link to the original account. That could be via a Facebook/Google/Twitch/etc. login, or it could be by having a GUID that you use as a Custom ID, which you provide to the user when they're signed in - that would be the way to do a "link" code.

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.

afroninjamx avatar image afroninjamx commented ·

Thanks for the response, that clears some things up. I didn't realize I could access the Playfab API from my own server. I figured maybe it was only accessible through cloudscript. Glad there's a way to implement a "link code" if I decide to go that route.

Lastly: how feasible is it to "ping" all active players with a message? I'd like to have a feature where I start a stream on twitch, and notify all players currently in the game that they can watch. Do I write one cloudscript to loop through all active players and push a message out? And would I just run it directly from my playfab dashboard? Or do I need to have the users poll the server every x minutes to check for something like this.

0 Likes 0 ·
brendan avatar image brendan afroninjamx commented ·

No, any operation that attempts to iterate across all players and take an action (apart from a scheduled task, which is specifically set up to do that) is going to fail, as it would consume far too many resources.

The real question is, how do you plan to notify players, and when will these things be announced? The simplest thing to do is to have a Title Data key/value pair that lists all the upcoming dates you want players to know about, so that you can just read that on sign-in (or once an hour or so, if players tend to stay signed in). If you mean sending players a Push Notification or an Email, you could do that through a Scheduled Task. But if you mean notifying players in realtime of things happening, your best bet right now would be to drive that via your own custom game server, as we do not maintain a socket connection to the client currently. So you would have that server (or servers) message out to all the connected players as soon as you know that you need to.

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.