Announcement

Collapse
No announcement yet.

GameCenter Guide - working setup - 4.15

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

    GameCenter Guide - working setup - 4.15

    Yo
    I received a PM asking for some more details on the gameCenter setup I use. Rather than just reply I thought I'd create a post with as much info as I have and could remember
    First off AFAIK there is still no multiplayer support so this just covers Leaderboards, Achivements and In-App Purchases ( IAP ). Leaderboards only grab the highest score in Blueprints.
    The tutorials from Epic on youtube cover a lot of this but not all in one place, from what I remember. I think the Unreal Match 3 video the most information, especially around achievements and what values to use ( if differs between android and iOS)
    So ... here goes

    Apple Developer site
    Obviously , you need an Apple developer account first
    Certificates , Identifiers & Profiles
    Click image for larger version

Name:	pic1.jpg
Views:	1
Size:	14.1 KB
ID:	1217399

    App IDs
    Click image for larger version

Name:	pic2.jpg
Views:	1
Size:	16.7 KB
ID:	1217400
    Click image for larger version

Name:	pic3.jpg
Views:	1
Size:	63.0 KB
ID:	1217401


    Provisioning Profiles
    - Distribution
    This is distrubution profile as we need to upload the .apk to iTunes Connect ( needs an Apple Mac and the Apple Uploader software or xCode )
    Click image for larger version

Name:	pic4.jpg
Views:	1
Size:	34.4 KB
ID:	1217402


    iTunes Connect Website
    First upload your .apk ( you need to package for distribution and sign with your distribution cert in unreal ( see below ))

    App Information – Make sure bundle ID matches AppID . From memory i think you pick the app from a list of your apps so this will always be correct, presuming you picked the correct app

    Features
    In short you will reference the ID of each item in your blueprints ( IAP - product ID , Leaderboard ID , Achievement ID )

    IAP
    Click image for larger version

Name:	pic5.jpg
Views:	1
Size:	19.1 KB
ID:	1217403
    Click image for larger version

Name:	pic6.jpg
Views:	1
Size:	12.5 KB
ID:	1217404

    LeaderBoards
    Click image for larger version

Name:	pic7.jpg
Views:	1
Size:	63.3 KB
ID:	1217405

    Achievement
    Click image for larger version

Name:	pic8.jpg
Views:	1
Size:	86.8 KB
ID:	1217406

    Now just add some testers , set your version of the app up for them to test and then have them download it through TestFlight ( Once you have done this it seems that you can push development builds from the editor to your phone/ipad and the online functionality still works )


    Unreal
    I have online subsystem set in two places, here you go

    Engine
    C:\Program Files\Epic Games\UE_4.15\Engine\Config\IOS\IOSEngine.ini
    [OnlineSubsystem]
    DefaultPlatformService=IOS

    Project
    C:\files\UE4\RRR\Config\DefaultEngine.ini
    [OnlineSubsystem]
    DefaultPlatformService=Null

    Editor Settings
    Edit Project Settings
    In packaging tick 'For Distribution' , it should automatically set to 'Shipping'
    then
    Click image for larger version

Name:	pic9.jpg
Views:	1
Size:	101.1 KB
ID:	1217407
    Note the Bundle Identifier matches the Development cert and what shown in iTunes connect

    Blueprints
    I have one blueprint that handles all the gamecenter stuff . My player controller creates an instance of this class to use for its online services. You can just put all the online stuff directly in the Event Graph of your player controller. I created a separate class so I could reuse it more easily. The instance of GameCenterHandler is passed a reference to the controller that owns it as the game center nodes need a player controller.

    Player controller creating an instance of the GameCenterHandler class
    Click image for larger version

Name:	pic10.jpg
Views:	1
Size:	85.9 KB
ID:	1217408

    The rest of this stuff is in my gameCenterHandler class but like I said you could just put this directly in the event graph of your player controller
    A lot of the game center functions are latent so I created custom events in the event graph as you can’t have latent calls in functions. I only call the events from functions in my gameCenterHandler, they sanitize input, parse raw leaderboard data back into game appropriate data etc. . It's these functions that I make public not the events, again, this is to make it more reusable

    Click image for larger version

Name:	pic11.jpg
Views:	1
Size:	198.0 KB
ID:	1217409
    Click image for larger version

Name:	pic12.jpg
Views:	1
Size:	230.3 KB
ID:	1217410

    When this all works you will get a 'Welcome back gameCenterUser' popup over your app when you login

    Any questions or mistakes etc. let me know

    rOb

    Sorry , I know this is in the wrong place ... trying to figure out how to move it to the IOS area :S
    Last edited by insanerob; 04-29-2017, 09:15 AM.

    #2
    Hello,

    Originally posted by insanerob View Post
    Unreal
    I have online subsystem set in two places, here you go

    Engine
    C:\Program Files\Epic Games\UE_4.15\Engine\Config\IOS\IOSEngine.ini
    [OnlineSubsystem]
    DefaultPlatformService=IOS

    Project
    C:\files\UE4\RRR\Config\DefaultEngine.ini
    [OnlineSubsystem]
    DefaultPlatformService=Null
    In IOSEngine.ini, I found the "DefaultPlatformService" entry. It was set to something like "MCP". Don't know it exactly anymore.
    But i couldn't find the "DefaultPlatformService" in the DefaultEngine.ini.
    Do I have to add it manually?


    And then I have also a question about the Leaderboards.
    In the Game Center section, I hade to create a group for the services.
    And now every Leaderboard-ID is forced to have a "grp." prefix.

    My Leaderboards are already Live and called like this: "grp.normal_mode".
    The Type is also "Single".

    When I want to open a Leaderboard, nothing happens...

    Thank you in advance

    Greetings
    Wolfi

    Comment


      #3
      Update:

      Originally posted by w0lfi View Post
      In IOSEngine.ini, I found the "DefaultPlatformService" entry. It was set to something like "MCP". Don't know it exactly anymore.
      But i couldn't find the "DefaultPlatformService" in the DefaultEngine.ini.
      The change of "DefaultPlatformService=" from "MCP" to "IOS" was the crucial point.
      Everything works now as expected.

      Thank you soo much!!

      Greetings
      Wolfi

      Comment


        #4
        glad it helped

        rOb

        Comment


          #5
          Hi insanerob,
          Is it necessary to login to Game Center to read or make in app purchases? In Android it is not needed. Do IOS behave differently?

          Comment


            #6
            Amazing guide! As [MENTION=515584]w0lfi[/MENTION] suggested, changing the DefaultPlatformService from MCP to IOS was the key!

            Comment


              #7
              Thank you for your tutorial!

              I'm trying to do this for our app, but I have a development certificate and provision instead.

              I added the "Show External Login" BP function and it runs when the app starts up (even tried a delay before it for safety).

              When running the game using the project launcher, the result of running the function is always a failure.

              Is there something I'm missing to tell my game to connect with Game Center?


              Note: I've downloaded Unreal's Match 3 and tied my provision/certificate to that app and it logs in successfully. However, I cannot find a difference between their and my logic.

              Comment


                #8
                Nevermind, it turns out I never checked the "Online Subsystem iOS" plugin in the Editor.

                If you're still updating this tutorial, I'd recommend adding this in. Though obvious, others may miss this like I did .

                Thank you for your tutorial again! Without it I'd probably miss setting up lots of other things. :P

                Comment

                Working...
                X