Announcement

Collapse
No announcement yet.

Integrating PlayFab Back End Service into Unreal Engine

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [PLUGIN] Integrating PlayFab Back End Service into Unreal Engine

    Introduction:

    I was looking around for a while on how to properly integrate PlayFab into Unreal Engine. After trying the PlayFab C++ SDK, with little luck as my c++ skills need work, I found Ufna's VaRest plugin. What a godsend. I used his JsonObject and JsonValueObjects but completely revamped the calls. With this plugin you can use one node to make the request and get back a response when it is received. Below is how to set it up and use it.

    Installation:

    To install the plugin, download the development fork from HERE.

    Next, copy the contents into <Game>/Plugins/PlayFab. You will need a c++ game for now. Next go to your uproject file, right click and select "Generate Visual Studio Files". Then open up the visual studio project file and move into "Setup".

    Setup:

    To use the PlayFab plugin you need to have an account with PlayFab, setup your title and have AppIds for that Title. You can find out all about that process HERE.

    Navigate to the c++ file located in "Games/<Project>/Plugins/PlayFab/Source/PlayFab/Private/PlayFabRequestProxy.cpp". Next open the file and near the top there are 7 FStrings that need to be updated to match your AppId.
    1. Change the <AppId> text in the URL to match your AppId.
    2. Chage the <AppId> to match your AppId.
    3. Input your AppId between " ".
    4. Input your secret key between " ".
    5. If you are using the photon services through PlayFab enter the corresponding AppId between " ".
    6. If you are using the photon services through PlayFab enter the corresponding AppId between " ".
    7. If you are using the photon services through PlayFab enter the corresponding AppId between " ".


    Here is a picture of the code.

    Click image for larger version

Name:	CppSetup.jpg
Views:	1
Size:	162.3 KB
ID:	1151847

    You are finished with the setup now rebuild your game and open up the Editor.

    Demo:

    To use the plugin all you do is drag an API call onto your Event Graph. The API calls can be found under PlayFab and then either Client or Server as can seen in the image below.

    Click image for larger version

Name:	PlayFabBluePrintMenu.jpg
Views:	1
Size:	104.6 KB
ID:	1151848

    Attach the node to an event, pass in the required variables and then attach whatever you want to handle the response up to the graph like below.

    Click image for larger version

Name:	LoginEvent.jpg
Views:	1
Size:	143.5 KB
ID:	1151849

    **That is all it takes!** The PlayFab nodes will send out the API call, wait for a response and pass back the response from the PlayFab servers. Take a look at their documentation to see what each API call returns and expects.

    I hope this helps anyone interested in using the awesome services provided by PlayFab.

    - Josh
    Attached Files
    Last edited by Lyons Den; 06-16-2015, 03:03 PM. Reason: Changed up the plugin a lot.

    #2
    Hey Josh,
    Great work! Just trying out playfab myself and this is great you put this together! hope to test it bit more soon

    Comment


      #3
      Good to hear it! The playfab and photon combo is great if used together. I just got play fab and the photon chat system up and running. The great thing about play fab is they have photon integrated if you have the higher tiers.

      Comment


        #4
        nice i was waiting for some playfab integration!! great job

        Comment


          #5
          Good job!
          Regards,
          Kia.

          Comment


            #6
            Hi,
            this plugin looks great, however I got an error. I am not familiar with C++ so I can't fix it right now.

            When I try to generate the Visual Studio Files I got the error that says:
            "\PlayFab.Build.cs(19,16) : error CS1520: Die Methode muss einen R?ckgabetyp besitzen." (The Method need to have a return value).

            Thx for your advice,
            Hendrik
            Last edited by HendrikE; 06-27-2015, 09:07 AM.

            Comment


              #7
              Hi , i am getting same error as HendrikE

              "PlayFab.Build.cs(19,16): error CS1520: Yöntemin bir dönüş türü olmalıdır " (The method need to have a return value)


              Edit:
              Fixing it easy

              rename the function to "PlayFab"
              public PlayFab(TargetInfo Target)
              Last edited by ihavenick; 06-27-2015, 08:01 PM.
              ihavenick.net | Free, simple tutorials and news.
              atacetin.net | My portfolio page

              Comment


                #8
                Yeah i had fixed it this way too, but now I can't perform any actions. When I try to register an account it's allways returns code: 500 (which means no JSON format).

                Comment


                  #9
                  Let me take a look at it and see what the issue is. It works in my game but I could have it setup slightly different. I apologize for the inconvenience.

                  Comment


                    #10
                    Updated the plugin with a couple of fixes that I was using with my game. Code 500 could also mean that you were sending the wrong parameters. If you get anything other than code 200 Play Fab sends error codes and the reason back to you. Read out all your responses using a print node with encode hooked to the response object and see what the error is telling you.

                    - Josh

                    Comment


                      #11
                      Hey man,
                      everything works now. I am so happy!
                      I send you a PM, read it!

                      Comment

                      Working...
                      X