Advertisement

Hunting for open GameKit solutions

On iOS, GameKit offers a simple way for applications to connect to each other using ad-hoc peer-to-peer communication without having to be connected to a common network. Despite its name, GameKit has been used for many non-gaming purposes as well as for games. These include contact information exchanges, media sharing, device-to-device presentations and so forth.

It's surprising, therefore, that Apple has not introduced a computer-based standard to allow Mac and Windows computers to participate in this information exchange (let alone Android and BlackBerry devices) using the common GameKit programming frameworks.

When you look closely at GameKit, you begin to experience the sense of top-down control and paranoia that permeates this implementation. If anything, Apple comes off as just a wee bit psychotic looking at the measures it takes to control GameKit connections, which are (after all) nothing more than Bonjour and Bluetooth handshakes.


Now, I understand that Apple's agreements with major recording labels have tinged the way the company transmits copyrighted information (which is why my AirPlayer/Banana TV applications do not support the highly encrypted RAOP standard), but GameKit mostly involves opt-in sharing of simple information like "where did my chess piece just move to?" or "what is this guy's address and phone number?" You simply have to approve who the information goes out to, and the person who gets the information has to OK the incoming data.

Let's start by looking at the handshaking part of the connection. Unlike normal Bonjour communication, GameKit does not use plain text tcp and upd names like _airplay._tcp.. Nope, every connection name is encrypted using SHA1 digests to produce an unrecognizable hash. Instead of _mikesgameapp._udp., you get something like _j3rd2iopqrsnw._udp.. I'm making the specifics up there, but you get the idea.

What's more, GameKit adds another hash to each host name. Instead of connecting to, say "Binky," you need to connect to 00sjtkK0A..Binky, a Bonjour host whose prefix includes further authentication information. In addition, each host announces the version it supports (the txtvers TXT field) and whether it is acting as a server ("A") or client ("B"), using the state TXT field.

Before you can even start the actual handshake, a GameKit connection must pass through these hurdles. If you do not do this correctly, the connection will not appear as a possible peer.

iOS developer Matthias Ringwald has been investigating GameKit and looking to open it up for use on OS X, Linux and Windows. As of yesterday, he had successfully gotten past the first hurdle -- reverse engineering the TCP/UDP service name to allow computers to advertise on Bonjour or search for matching services using a standard Bonjour net services browser -- but that's about as far as things have gotten. Getting the server name hash and effecting the handshake are challenges that remain.

Reversing GameKit looks like a slow and arduous process, but it wouldn't be the first time Apple technologies were opened to outside use.