Ios – Building the own game server for a turn-based multiplayer iPhone Game

gamekitiosiphoneruby-on-rails

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!

Best Answer

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.

Related Topic