Can two iPT's use Bluetooth to connect for a game?

Discussion in 'iOS Programming' started by 1458279, May 28, 2012.

  1. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #1
    I just got a second IPT 4G and was thinking of some cool things that could be done.

    Something along the lines of connecting the two devices via Bluetooth for gaming or other interaction.

    I turned on Bluetooth for each and they didn't seem to see each other.
     
  2. Ricky Smith macrumors regular

    Joined:
    Jan 28, 2006
    Location:
    Boston, MA
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    Yes, I've never actually released a game that used Bluetooth, but I did make several proof of concepts last year.

    I'm not at my computer with the projects on them, but as I recall, they utilized GameKit.

    I think Apple has a sample project called GKTank which demonstrates how to do it.

    I believe Ray Wenderlich also has a free tutorial on his website covering it, if tutorials are more your thing: http://www.raywenderlich.com/3276/h...player-game-with-game-center-tutorial-part-12

    (I had that bookmarked as a tutorial for multiplayer iOS games; I can't remember if it covers wifi only or Bluetooth as well.)
     
  4. idelovski macrumors regular

    Joined:
    Sep 11, 2008
    #4
    I have 1st gen iPod Touch and a 2nd gen so I know that 1st gen didn't have a Bluetooth, but the second one did. And at some point, before I bought the second iTouch I had to pair my 3GS with the simulator and even that worked. First I had to turn on Bluetooth on my Mac and then turn on tethering on 3GS and connect it over USB to the Mac.

    GameKit is complicated at first, but once you have all the parts/boilerplate it is pretty straightforward and same code can easily be used from project to project.
     
  5. xStep macrumors 68000

    Joined:
    Jan 28, 2003
    Location:
    Less lost in L.A.
    #5
    Yes you can run a game over Bluetooth between two (or more) devices. I did it a couple of years ago. My game was able to work over the local Wi-Fi and when that wasn't available would use Bluetooth if the devices had it turned on.

    I used Bonjour to advertise the 'service' (game), NSNetService frameworks, and some low level sockets code. I can't remember the details now.

    In "iPhone Games Projects" they discuss networking options. In "iPhone Cool Projects" there is also a good discussion on the topic. Both these books are from Apress and each contain good information on the subject.

    In iTunes U (iTunes store) at least one of the older Stanford sessions discussed this topic also. I don't recall which one. It had the basics. This is free.

    Also on iTunes U and free is "Advanced iPhone Development- Fall 2010" from Madison Area Technical College course which has a 2hr:11min session on Networking.

    Past WWDC session videos are also available on the subject.

    BT on iOS is limited. You won't be able to communicate with an Android device for instance.
     

Share This Page