views:

155

answers:

2

Hi all,

I want to develop an online multiplayer game for iphone.

I have developed two iphone applications but they weren't games.

so This is my first game .

so Basically I know nothing about how online multiplayer games works on iphone.

I just want to know the strategy , beginner's precautions and other design elements that helps me in understanding multiplayer games in iphone .

e.g.: If there is an online casino game (not bluetooth) ,how the connections and sessions work between all players.How they manage turns , results .

EDIT I have put these questions separately also as suggested by Brad Larson and ChrisF :

How the game will search for other online users and will display the list of all users ?

How one can request someone to join the game and then visible to other users ?

How the connection and session will work between players of a table ? (Sockets ?)

What sort of network programming is necessary as part of the server and client ?

please tell me how all these works ? ( Just concepts )

Thanks .

+1  A: 

One thing you might need is a server to store the game state as you can't guarantee that both (all?) players will be on-line at the same time. One of the things this would store would be whose turn it was.

Then when a player turns on his/her phone or starts the game they would see a message saying it's their turn.

You could use this server to store high scores and tables too.

ChrisF
thanks for your quick and good answer . but what about connections , sessions ? are they continuous ? How synchronization will work among them ?
hib
@hib - I think I'd need to know a *lot* more about your game, but this isn't the place. Perhaps you need to ask some other, more specific, questions.
ChrisF
hey Chris thanks again for your good and kind answer , Can you redirect me where ? Thanks again sir .
hib
@hib - I meant to ask more specific questions here on Stack Overflow, sorry my comment was ambiguous.
ChrisF
@ChrisF Ok Thank again for showing your kindness . I will be more specific in my next question , an I am going to edit my current question also . Thanks again sir.
hib
+2  A: 

How the game will search for other online users and will display the list of all users ?

You'll need a server that returns a list of online players to your iPhone client is some kind of data format, maybe XML or JSON.

How one can request someone to join the game and then visible to other users ?

The easiest approach would be the person who wants to to join the game sends that command to the server, the server tells that other person they want to join. Wait for a response. If player two says "yes", returns to the server which forwards to the first player.

It's basically a series of commands sent to and from the server. This is how all multiplayer games work - for example the Quake engine sends very compact commands, as little as 4 bytes for things like "get me all players on a server". Given the flakeyness of the iPhone connection this would be a good model to copy, as the Quake networking code was designed for 56k modems.

How the connection and session will work between players of a table ? (Sockets ?)

The connection could either be a continuous stream (UDP would be best), or polling from the client. You'll need to consider scaling for both, as it's possible 100 people playing could bring your server to its knees.

The session will be dropped if one player loses their connection. Alternatively as it's turn based, each player can simply send a command when they're online and the other client picks this up when he's online - there's no need for session in this model, and the commands are stored on the server in a datastore.

What sort of network programming is necessary as part of the server and client ?

I'll broaden this out:

  • An in depth knowledge of byte and bit manipulation including bit shifting
  • A knowledge of creating and reading UDP packets
  • Network programming in C (Objective-C may simplify a lot of this)
  • The server: writing daemons on Linux, or services on Windows to listen for commands
  • A knowledge of SOAP, XML or JSON if you're not concerned with bandwidth and connection drops
Chris S
great answer . I was looking for this type of answer that satisfies all my queries conceptually .
hib