5

I've made an iOS game that works over both Bluetooth and bonjour. It works great both ways, but I'd really like it if players could play with eachother with any Internet connection, be it edge, 3G, or different wi-fi addresses.

The catch: I don't have the resources or knowledge to set up dedicated servers or anything like that. It seems that surely GameKit has something in it that will let me do this, but despite spending dozens of hours over the last week figuring out how to use it, I've found nothing.

So, does anyone have ideas for solutions? My game is just one on one, if that makes it any easier.

ArtOfWarfare
  • 20,617
  • 19
  • 137
  • 193
  • Establishing a connection will be complicated. You've got to find some way for one of the phones to find an IP address to speak to the other. Also, I believe that carriers usually block unsolicited incoming connections over 3G for security purposes. It may be that this is impossible. I'm not 100% sure though. – George Aug 19 '11 at 05:33

2 Answers2

2

Why don't go through the Game Center with GameKit?

Apple provides all the infrastructure to play all around the world via their servers (in 3G or Wifi). With the Game Center you can play up to 4 players (so in your case there is no problem), it's free, you don't have to manage any server, there is a mechanism of invitation between friends, and many more.

The logic of your game stay in the client side, so it'll be same design as your actual game (expect for the API I think).

You can find all information on the official documentation here. If you want, there is a very tuto on the ray wenderlich's blog (but it uses the cocos2d framework instead of the CocoaTouch).

Yannick Loriot
  • 7,107
  • 2
  • 33
  • 56
  • Wow, thanks for those links. For anyone who doesn't see the stuff on Apple's documentations, it's mostly on this specific page of the document he linked to: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Matchmaking/Matchmaking.html#//apple_ref/doc/uid/TP40008304-CH9-SW1 – ArtOfWarfare Aug 19 '11 at 14:56
1

Yep, try GameCenter with GKMatch - works really well if game doesnt need to send tons of data. If you make additional layer between your app and GKMatch and GKSession, you can use both transparently (so your game supports local AND global multiplayer). Tested, it works

Siegfried
  • 543
  • 3
  • 19