question

Michael Flanagan avatar image
Michael Flanagan asked

Is there a description or model of how external servers "connect" to PlayFab?

I understand (I think!) that I can have PF connect to an external server. I want to know if I can have an external server initiate an API call to PF. Is there a specific doc that explains the model, explaining limitations, etc.?

Here's my scenario, hypothetical for now: I have several games integrated into PF. I also have an app that lets a gamer, external to PF and his games, swap/exchange digital assets (gold coins, arrows, etc.) in one game for digital assets in another. The author(s)/publisher(s) specify which assets can be exchanged, and what they're worth. So suppose <GamerMike> ways, "I want to exchange 50 of my gold coins in <Game 1> for 500 arrows in <Game 2>." At that point I'd like our server to contact PF (I'm guessing here) to say, "I have PF-authenticated gamer <GamerMike>; please deduct 50 gold coins from his account in <Game 1>." Assuming I get an ok response, I then say (POST/PUT), "I have PF-authenticated gamer <GamerMike>; please add 500 arrows to his account in <Game 2>"

  1. Let's put aside the problem of authenticating <GamerMike> to PF for the moment.
  2. What do I do in <Game 1> and <Game 2> to "receive" those POST/PUT calls and act on them? Is this even possible?
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

If <Game 1> and <Game 2> are all PlayFab titles, you won’t need an external server to handle it. It will be easier if 2 games are in the same studio.

The basic idea is to create few Azure Functions according to your requirement and define 2 PlayFabServerInstanceAPI separately for Game 1 and Game 2 in the function. Player A in Game 1 simply calls ExecuteFunction and after necessary verification is done, the function may call different PlayFabServerInstanceAPI to perform the actions you require.

Please feel free to let me know if you need more details about Azure Function, and you may get started from this document -- PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Docs

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.

Michael Flanagan avatar image Michael Flanagan commented ·

Thanks. I'll consider that architecture/design. My architecture, though, is that the gamer is using our separate application, and he/she can see the various game assets (names and amounts) in that app, and do the transfer from there. That's our current thinking, but your suggestion makes sense. One fly in the ointment is that not all games will be PlayFab titles (although if need be we could limit our vision).

Given my current thinking, any thoughts on how I could do that...that is, have an external server GET/POST/PUT something to a "PlayFab server"? Or am I trying to do something never intended by the PF design?

Again, thanks for the tip on how to do it with PF titles. I'll look into that.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Michael Flanagan commented ·

If you have an external secure server, you may simply integrate PlayFab SDK and use Server API to handle PlayFab related data.

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.