Multiplayer game in iphone - concept, strategy, design? [closed]

╄→尐↘猪︶ㄣ 提交于 2019-11-29 15:49:45

问题


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:


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



回答2:


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.



来源:https://stackoverflow.com/questions/3131780/multiplayer-game-in-iphone-concept-strategy-design

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!