Datasnap 是否适合最多 8 人的非通信密集型双向多人游戏?
我正在构建一个小型多人游戏,需要以下内容:
- 它必须用 Delphi 编写
- 必须支持 Internet 连接(不仅是 LAN)
- 通过 HTTP 工作
- 支持数据包的某些加密(可能是自定义的)
- 能够向服务器发送命令
- 能够从服务器接收响应
- 能够将最多 8 个玩家连接到一台服务器
- 能够将复杂的对象(可能是 JSON 序列化)传递到服务器
您认为新的 Delphi 2010 Datasnap 可以在这种情况下成功使用吗?我使用普通的旧 TSocket 吗?
I am building a small multipliplayer which will need the following:
- it must be written in Delphi
- must support Internet connection (not only LAN)
- work over HTTP
- support some encryption of the packets (it may be custom)
- be able to send commands to the server
- be able to receive responses from the server
- be able to connect up to 8 players to one server
- be able to pass complex objects (maybe JSON serialized) to the servers
Do you think the new Delphi 2010 Datasnap can be used successfully in this scenario or should I go with the plain old TSocket?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
DataSnap 可以完成上面列出的所有操作:
所以回答你的问题,是的,我认为新的 Delphi 2010 DataSnap 可以在你的场景中使用。
DataSnap can do all that you've listed above:
So to answer your question, yes, I think that the new Delphi 2010 DataSnap can be used in your scenario.
正如尼克所说,答案是肯定的。
Bob Swart 撰写了一份白皮书并制作了一些有关更新后的 Delphi 2010 中的 DataSnap< 的视频/a> 这可以帮助您入门。
As Nick said, the answer is Yes.
Bob Swart wrote a white paper and produced some videos on the updated DataSnap in Delphi 2010 that can help get you started.
如果您的多人游戏不发送太多数据,HTTP 和 Datasnap 可能会起作用。如果您需要快速通信,我会使用 UDP 和自定义二进制协议。除非您必须绕过公司防火墙,该防火墙会阻止除 HTTP 之外的几乎所有协议(而且公司通常不喜欢人们在工作时间玩游戏),否则防火墙会阻止传入连接,而不是传出连接。只是服务器需要打开端口来允许客户端连接。
我也会避免使用 JSON - 如果您不需要互操作性,则二进制序列化要快得多。
If your multiplayer game doesn't send much data HTTP and Datasnap may work. If you need a fast communication, I'd use UDP and custom binary protocol. Unless you have to bypass a company firewall that stops almost any protocol but HTTP - and companies usually don't like people playing in their working hours - a firewall blocks incoming connection, not outgoing. Just the server needs open ports to allow clients to connect.
And I'd avoid JSON as well - if you don't need interoperability a binary serialization is much faster.