PDA

View Full Version : Bluetooth Multiplayer Works, want it Online?




ArtOfWarfare
Aug 16, 2011, 08:59 AM
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.)



ArtOfWarfare
Aug 18, 2011, 01:42 PM
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:

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

- (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?