Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building my own game server for a turn-based multiplayer iPhone Game

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!

like image 918
BeachRunnerFred Avatar asked Oct 04 '10 15:10

BeachRunnerFred


People also ask

Do you need a server to make a multiplayer game?

If you're building a game that's mostly player-to-player interaction, without a ranked competitive system, you may not need servers at all. For example, Minecraft does this particularly well. You can play by yourself, on a local network, connect to servers hosted by other players, or host your own server.

What is server based multiplayer?

This system comprises a server and a plurality of clients, and the server can execute a plurality of game programs. Each client can access the plurality of game programs that the server executes, and a game image created by the accessed game program is displayed on a display unit of the client.

How do server based games work?

A dedicated gaming server is a computer that hosts a video game for a client. This type of server enables a reliable, stable, and fast connection to your favorite online games. Dedicated game servers offer more processing, memory, and storage capabilities than other hosting solutions.

How does a multiplayer game server work?

A game server (also sometimes referred to as a host) is a server which is the authoritative source of events in a multiplayer video game. The server transmits enough data about its internal state to allow its connected clients to maintain their own accurate version of the game world for display to players.


2 Answers

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.

like image 157
Henrik P. Hessel Avatar answered Oct 20 '22 00:10

Henrik P. Hessel


iOS 5.0 adds support for turn-based games, see http://developer.apple.com/technologies/ios5/ .

like image 29
piokuc Avatar answered Oct 19 '22 23:10

piokuc