Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ArtOfWarfare

macrumors G3
Original poster
Nov 26, 2007
9,706
6,289
Okay, so I've made a two player game that works using Game Kit and bluetooth right now. It was pretty easy to set up and does exactly what I want it to.

Now I'd like to make my game work online. What's the easiest way I can go from what I have now, to having it work online?

I don't know how to do any programming with servers or anything, and I don't want to spend money to buy/rent servers (I don't expect the game to be popular enough to be worth spending money on... it's more just an exercise for me to figure out how it's done.)
 
Last edited:
It looks like Game Center / Game Kit might be capable of doing this for me... but I don't understand the documentation.

Right now, I have this for finding another player via bluetooth:

Code:
-(IBAction)nearbyFriend:(id)sender
{
    findItFirstPeerPicker = [[GKPeerPickerController alloc] init];
    findItFirstPeerPicker.delegate = self;
    findItFirstPeerPicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
    [findItFirstPeerPicker show];
}

Code:
- (GKSession *)peerPickerController:(GKPeerPickerController *)picker sessionForConnectionType:(GKPeerPickerConnectionType)type
{
    GKSession *session = [[GKSession alloc] initWithSessionID:@"com.TaylorMarks.FindItFirst" displayName:nil sessionMode:GKSessionModePeer];
    return [session autorelease];
}

- (void)peerPickerController:(GKPeerPickerController *)picker didConnectPeer:(NSString *)peerID toSession:(GKSession *)session
{
    self.findItFirstSession = session;
    session.delegate = self;
    
    picker.delegate = nil;
    [picker dismiss];
    [picker autorelease];
}

Would changing my game to work online be a simple matter of changing findItFirstPeerPicker.connectionTypesMask = GKPeerPickerConnectionTypeNearby; to findItFirstPeerPicker.connectionTypesMask = GKPeerPickerConnectionTypeOnline;

in the first code snippet?

The reason I'm confused is this statement in the documentation:
Although users can select Internet connections in the peer picker, GKPeerPickerController has no user interface for configuring them. If your application configures the peer picker to allow Internet connections, your application must also dismiss the peer picker and present its own interface to configure an Internet connection.

How do I program my own UI? Where am I getting the data from that it displays?
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.