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!
Answer by pfnathan · Apr 27, 2018 at 10:17 PM
Please have a look at this discussion on the forum:
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
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?
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.
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
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).