回合制多人游戏:WCF 还是 Socket?
我想就我的问题提出建议。
我们正在创建一个具有以下功能的多人互联网国际象棋游戏:
- 游戏将支持大量并发用户
- 我们将在磁盘上物理保存每个游戏动作(例如使用 SQL Server 数据库)
- 我们将使用相同的 SQL Server 进行会话太多
- 个游戏服务器将用于负载平衡/可扩展性
- 所有游戏服务器将相互连接
- 所有游戏服务器也将连接到该 SQL Server
- 由于这是一个国际象棋游戏,因此只有 2 个用户可以玩游戏,但
- 数量不受限制的用户可以查看此内容作为观众实时游戏(广播)
- 观众/游戏用户可以选择私下或公开发送和接收聊天消息。
- 我们将在数据库中维护我们自己的用户列表。因此,我们需要一个自定义的身份验证系统。
客户端将是桌面 Windows 窗体/wpf 应用程序。我们也在考虑基于在线浏览器的版本,但我们已将其放在未来,目前我们专注于桌面版本。
现在我的问题是?
- 我们应该使用哪种技术,Sockets 还是 WCF?
- 首选的序列化方式是什么:XML、二进制或自定义 二进制?
也欢迎任何其他意见/建议/方向。
谢谢
I would like to have an advice regarding my problem.
We are creating a multi-player internet chess game having these features:
- Game will support a very huge amount of concurrent users
- We will be saving each game move physically on disk (e.g. using SQL Server Database)
- We will utilize the same SQL Server for Sessions too
- Multiple Game Servers will be utilized for load balancing / scalability
- All the Game Servers will be connected to each other
- All the Game Servers will also be connection to that SQL Server
- Since this is a chess game therefore only 2 users can play game but
- Unlimited number of users can view this game in real-time as audience (broadcasting)
- Audience / Game Users will have an option to send and receive chat messages, privately or publicly.
- We will maintain our own User List in Database. Therefore we will be requiring a custom authentication system.
The client will be a desktop windows forms / wpf application. We are also thinking for an online browser based version too but we have put it for future, currently we are focusing on desktop version.
Now my questions are?
- Which technology we should use, Sockets or WCF?
- What is the preferred way of serialization, XML or Binary or Custom
Binary?
Any other advice/suggestion/direction is also welcome.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是我的意见。
套接字
WCF
无论你要使用哪种序列化,WCF 都会比套接字慢。
无论如何,您不会使用“HipHop for PHP”。我认为,答案是,使用 WCF 创建简化的客户端和服务器应用程序。使用不同的绑定、序列化等最大程度地加载它(正如您所想象的那样)。如果 WCF 可以处理负载并具有良好的保留,那么我认为您可以使用它。如果不是 - 使用套接字。
也许是使用这两种技术的最佳方式。性能至关重要的套接字(例如将游戏服务器相互连接),WCF 用于其他部分(例如发送和接收聊天消息)。
我相信这两种技术还有很多其他的争论。但我认为问题是:你想要更快还是更容易维护。它是一个经常添加功能的应用程序,还是一个负载将呈几何级数增长的应用程序。等等等等
Here my opinion.
Sockets
WCF
Doesn't matter what kind of serialization you're going to use, WCF will be slower than sockets.
Anyway you're not going to use "HipHop for PHP". I think, the answer is, create simplified client and server applications using WCF. Load it on maximum(as you suppose it will) using different bindings, serializations, etc. If WCF can handle the load and has a good reserve, then I assume, you can use it. If it's not - use sockets.
Maybe the best way to use the both technology. Sockets where performance is critical(e.g. connect game servers to each other), WCF for other parts(e.g. send and receive chat messages).
I believe there's a lot of other arguments for both technologies. But I think the question is: Do you want get it faster or get it easier to maintain. Is it an application where features are being added often, or is it an application where the load will grow in geometric progression. etc. etc.
除了丹尼尔的回答之外:
抽象您的通信代码并从 WCF 开始。如果最终速度变慢(我认为不会),您仍然可以相对轻松地切换到套接字。
In addition to Daniil's answer:
Abstract your communication-code and start with WCF. If it is to slow in the end (I don't think it will) you can still switch to sockets with relative ease.