views:

162

answers:

2

From the Game Kit Programming Guide...

Multiplayer allows players interested in playing an online multiplayer game to discover each other and be connected into a match. Depending on your needs, your application can have either use Game Kit to connect all the participants together, or have Game Kit deliver a list of players to you. In the latter case, you would provide your own network implementation that connects the players to a server you provide

I'd like to build a multiplayer, turn-based iPhone game for the Game Center and will need to write my own game server. I plan to use the Game Center API for player authentication, scoreboards, and pairing up players, but I'll still have to build my own turn-based game server to control the multiplayer communication. It's a time-based game, so the server will handle things like synchronizing the start of the game and notifying the players when the game is completed, along with the results of the match. At this point I'm just trying to figure out where to start with building the game server and I'm really struggling to find any good resources that cover...

  1. How turn-based game servers are structured and implemented. Ideally, I'd like to find a book or online article that has examaple code, but every book I read that discusses multiplayer gaming on the iPhone says the same thing, "Developing a Web server is outside the scope of this book, but we’ll focus on the client side code necessary to connect to such a server.". Where can I find the info on developing the web server?!

  2. Good libraries/APIs to use

  3. Security concerns and common solutions
  4. Existing open source packages
  5. I've been wanting to Learn Ruby on Rails for other upcoming projects and I'd like to kill two birds with one stone, could this framework work well for implementing a turn-based game server?

Can anyone help steer me towards some good books or online resources that covers this topic? Or answer my questions directly? I have to think that developing a game server is a very common problem for anyone building games for the iOS Game Center since most of them are multiplayer, but I can't figure out why there are no resources that cover how it's done.

Thanks so much in advance for your help!

+1  A: 

You asked several separate questions, so I'll give brief answers.

How turn-based game servers are structured and implemented
Like any other server it listens for connections, processes requests and sends responses.
It's quite easy to write a web service which uses JSON / XML. I think this will be the best and quickest solution to your problem (subjective)!

Good libraries/APIs to use Though there're several good frameworks and libraries on the desktop side of game programming, I can't think of any "web based" library.

Security concerns and common solutions
Basic Authentifcation and OAuth are two of several possibilities to secure your web service.

Existing open source packages
You already mentioned Ruby on Rails but I recommend Django for it's great documentation to get you started. I built my iPhone webservice around Django Piston, which is a great mini framework.

I've been wanting to Learn Ruby on Rails for other upcoming projects and I'd like to kill two birds with one stone, could this framework work well for implementing a turn-based game server? Yes, see my answer above.

Henrik P. Hessel
Thanks, Henrik! I'll look into Django Piston.
BeachRunnerJoe
+1  A: 

There are a couple of multiplayer server offerings in the market that you could use to build your own, turn-based server.

You could take a look at unionplatform.com. Apparently, there is no client SDK for the iPhone, yet. But the community is starting to think about building one (see http://www.unionplatform.com/?p=1446).

Also check out OpenFeint. Maybe they cover what you need.

I know this is not a comprehensive answer, but I am sure others will elaborate.

Joseph Tura
Correct me if I'm wrong but OpenFeint doesn't allow you to implement your own game logic, does it? It's just an addition to your existing infrastructure to support ladderboards, push notifications, and archivements.
Henrik P. Hessel
I have to admit that I have not actually implemented anything with OpenFeint. But according to their documentation, you can build turn-based multiplayer games. Of course it is not as powerful as having your own server. See their "Turn-Based Multiplayer Implementation Guide" http://www.openfeint.com/ofdeveloper/index.php/kb/article/000074
Joseph Tura
Thanks, Joseph, that link looks very promising since two-player is exactly what I need to support.
BeachRunnerJoe