在iphone的多人游戏

在iphone的多人游戏

本文介绍了在iphone的多人游戏 - 概念,战略,设计?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为iphone开发一款在线多人游戏。

I want to develop an online multiplayer game for iphone.

我开发了两款iphone应用程序,但它们不是游戏。

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

所以这是我的第一款游戏。

so This is my first game .

所以基本上我对在线多人游戏如何在iphone上工作一无所知。

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

我只想知道策略,初学者的注意事项以及其他有助于我理解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
我也按照Brad Larson和ChrisF的建议单独提出这些问题:

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

please告诉我这些是如何工作的? (只是概念)

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

谢谢。

推荐答案

游戏将如何搜索其他在线用户并显示所有用户的列表?



您需要一台服务器,它会向您的iPhone客户端返回一个在线玩家列表。数据格式,可能是XML或JSON。

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.

最简单的方法是想要加入游戏的人将该命令发送到服务器,服务器告诉他们想要加入的其他人。等待回复。如果玩家2说是,则返回到转发给第一个玩家的服务器。

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.

它基本上是一系列发送到服务器和从服务器发送的命令。这就是所有多人游戏的工作方式 - 例如Quake引擎发送非常紧凑的命令,只需4个字节就可以让我把所有玩家都放在服务器上。考虑到iPhone连接的灵活性,这将是一个很好的复制模型,因为Quake网络代码是为56k调制解调器设计的。

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.

连接可以是连续流(UDP最好),也可以是客户端轮询。你需要考虑两者的缩放,因为可能有100人玩游戏可能会让你的服务器瘫痪。

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.

我会扩大这个范围out:

I'll broaden this out:


  • 深入了解字节和位操作,包括位移

  • 知识创建和读取UDP数据包

  • C语言中的网络编程(Objective-C可能会简化很多此类工作)

  • 服务器:在Linux上编写守护进程,或Windows上的服务以侦听命令

  • 如果您不关心带宽和连接丢失,请了解SOAP,XML或JSON

  • 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

这篇关于在iphone的多人游戏 - 概念,战略,设计?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 22:05