question

sowee avatar image
sowee asked

Calling cloudscript fom custom server?

Hi,

I'm building a multiplayer game and will probably be using Photon Bolt as I want authoritative movement/logic. Bolt allows me to have one of the client be the server or, if I want full authority, I can have a decicated server. As far as I understand, since the server would be a uniy build, I could use your custom server infrastructure to manage it. Now, when a game ends, I'd like the server to be the one to initiate the process of rewarding players, since it knows the results of the game (who won, etc). I think it should call a cloudscript function, passing all the players info and this function would reward each player and then notify (?) them of their reward. Not sure if this is the best workflow. Is there another way of doing that?

Thanks!

photonCustom Game ServersPlayer 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

·
pfnathan avatar image
pfnathan answered
9 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.

pfnathan avatar image pfnathan ♦ commented ·

Btw, It would actually be much better for you to just make the call from your server and not going thorough CloudScripts path, Can you let us know why you are not approaching this way? - thanks

0 Likes 0 ·
sowee avatar image sowee pfnathan ♦ commented ·

Thanks, I'll have a look. As for your question, you mean use the playfab client API (sdk in unity) from my unity headless server? In Photon Bolt the server can be one the client, so I thought I'd have my reward logic on the server. But I'll probably run bolt on a headless server, so I agree I could do it as you suggested. Is it what you meant?

0 Likes 0 ·
brendan avatar image brendan sowee commented ·

No, he's referring to having the logic in your server, rather than Cloud Script. Since you're doing multiple actions for every player, it would be much better to just make those calls from your server, since Cloud Script has relatively small limits for total runtime and the number of Server API calls you can make from it.

1 Like 1 ·
Show more comments
sowee avatar image sowee pfnathan ♦ commented ·

Just as a side note: if I need to make several calls from my server (for instance, check the player had enough lives to play, reward him, remove life, etc), isn't it better to aggregate this logic in a cloudscript endpoint that just run "locally" ? Thanks

0 Likes 0 ·
brendan avatar image brendan sowee commented ·

It's the same number of API calls, and the same amount of work in the PlayFab service, either way. With a custom game server, you can make more frequent updates to the locally-stored data, and periodically update the backend, since you shouldn't be making more than a few calls to the service per player, per minute, on average (bursts are fine, it's just that the average number of calls per minute over the life of the session should be within reason). So for example, if you have a shooter game, you would update everything about the player - world position, damage taken, bullets remaining, etc., pretty much constantly. But you would only update the backend with the aggregated info about the player state at the end of the session (or every couple of minutes, if the sessions are long).

0 Likes 0 ·
Show more comments

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.