-->
julis

How-To : UDK Multiplayer Gamecenter IOS

How-To : UDK Multiplayer Gamecenter IOS
This is step-by-step to enable multiplayer gamecenter in UDK, i got it from Epics Forums, i write it here just in case i forgotten the steps
here it is :

1, Use May build ... June / July GC doesn't work for us

2, First you need to get your iOS provisioning stuff in place : Go onto your Apple Dev - Provisioning Portal ( unless you did it right the first time  ), 
a, Create a new AppId for your game. Even though it will say GC enabled you'll need to do a bit more to get it to work  . 
b, Create a new Provisioning profile for you game using the AppId you just created , tick your cert and add the devices you will be testing on. Submit the cert and download it.

3, Now you need to tell iTunes and GameCenter about your App .
a, Browse to itunes connect - itunesconnect.apple.com and log in with your Apple Dev account info 
b, click the link to Manage Your Applications 
c, Add New App
d, App Name - Title of Your Game e.g. Monkey Ninjas from Uranus blah blah
- SKU Number - essential a revision number of the app that meant something to you .... e.g. 01
- Bundle ID - Select the App ID you created earlier
... fill in all the rest of the stuff regarding categories , contact etc.
Click Manage Game Center - Enable multiplayer 
e, Make a note of the Bundle Identifier !!
N.B. Don't upload your game - Leave it in a status of 'prepare for upload' .. you only upload when you are ready to release the game.

4, IPhoneEngine.ini set bDisableGameCenter=false .... once this is in place when you load your game on an iOS device it will fire up gamecenter as it loads


N.B. make sure that you add this to your Engine ini files and that it gets propagated to your ini files when you compile / package as OnlineSubsystemGameCenter is not packaged by default
[UnrealEd.EditorEngine]
+EditPackages=OnlineSubsystemGameCenter

5, In UnrealFrontend / Application Settings / Already a registered iOS developer - add the new mobileProvision you created in step 2b . In the Info plist make sure you use the bundle identifier as it appears in iTunes connect step 3e ... if you get it wrong you'll get a message as you load the game saying Application not recognized 

6, install your app on your iDevice using frontend.

7, Log out of game center and then fire up the app on your iDevice. This is important as you will need to create a sandbox GC account for testing games, you can't use live GC accounts. You should see the familiar GC screen during the initial Epic splash movie as your game loads. Create a new account when prompted, this will automatically create a sandbox account rather than a regular account. Log in with your new sandbox account.


8. insert this snippet to UTPlayerController.uc



//julis mod
// These don't need to be filled in with data but they cannot be None or ShowMatchmakingUI will crash




simulated event PostBeginPlay()
{
    super.PostBeginPlay();
}




function ClearCreateOnlineGameDelegates()
{
    OnlineSub.GameInterface.ClearCreateOnlineGameCompleteDelegate(OnCreateOnlineGameComplete);
}
function OnCreateOnlineGameComplete(name SessionName,bool bWasSuccessful)
{
    local string URL;
    local string MapName;
local string GameTypeName;
    if(!bWasSuccessful) {
        ClearCreateOnlineGameDelegates();
        `Log("OnCreateOnlineGameComplete was NOT successful");
        return;
    }
    MapName = WorldInfo.GetMapName(true);                   // Retrieve Map Name
GameTypeName = PathName(WorldInfo.GetGameClass());      // Retrieve Game Type
    URL = MapName $ "?game=" $ GameTypeName $ "?listen";    // Make URL


    `Log("Resulting URL is ("$URL$")");
    ClientTravel(URL, TRAVEL_Absolute);


    ClearCreateOnlineGameDelegates();
}




function ClearJoinOnlineDelegates()
{
    OnlineSub.GameInterface.ClearJoinOnlineGameCompleteDelegate(OnInviteJoinComplete);
}
function OnJoinOnlineGameComplete(name SessionName,bool bWasSuccessful)
{
    local string URL;


    if(!bWasSuccessful || OnlineSub == none || OnlineSub.GameInterface == none ) {
        ClearJoinOnlineDelegates();
        return;
    }


    if (OnlineSub.GameInterface.GetResolvedConnectString(SessionName,URL))
    {
        // allow game to override
        URL = ModifyClientURL(URL);


        `Log("Resulting url is ("$URL$")");
        // Open a network connection to it
        ClientTravel(URL, TRAVEL_Absolute);
    }
    ClearJoinOnlineDelegates();
}
exec function test()
{
 OpenNativeMatchmakingUI();
}


function OpenNativeMatchmakingUI()
{
local OnlineGameSearch SearchSettings;
local OnlineGameSettings GameSettings;
    local OnlineSuppliedUIInterface OSI;

    SearchSettings = new class'OnlineGameSearch';
   
    if(OnlineSub == none)
        OnlineSub = class'GameEngine'.static.GetOnlineSubsystem();


    if(OnlineSub == none) 
        return;


    if(OnlineSub.GameInterface == none)
        return;

GameSettings=OnlineSub.GameInterface.GetGameSettings('Game');


    OSI = OnlineSuppliedUIInterface(OnlineSub.GetNamedInterface('SuppliedUI'));
    if (OSI == none)
        return;


    OnlineSub.GameInterface.AddCreateOnlineGameCompleteDelegate(OnCreateOnlineGameComplete);
    OnlineSub.GameInterface.AddJoinOnlineGameCompleteDelegate(OnInviteJoinComplete);
    OSI.ShowMatchmakingUI(0,SearchSettings, GameSettings);
    
}
//end mod


9. build the game (Compile-Cook-Package)
10. Deploy to multiple iDevice


julis
julis
Load comments