跨网络游戏数据
我正在设计一款游戏,玩家是编程机器人,在编程竞赛中竞争。这些机器人可以使用任何语言进行编程 - Java、Ruby、Python、C#。我正在寻找某种方式通过网络传输游戏数据,或者游戏服务器可以与机器人对话。对此,什么是更好的选择?我应该使用 XMPP 还是其他形式的远程方法调用?
I'm designing a game where players are programmed bots competing in a programming contest. The bots can be programmed in any language - Java, Ruby, Python, C#. I'm looking for some way to transmit game data across the network or some way by which the game server can talk to the bots. What would be a better choice for this? Should i use XMPP or some other form of remote method invocation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您所描述的不是 RMI 问题,而是消息传递问题。我确信您可以使用多种解决方案,并且基于您对应用程序的有限了解,我认为 XMPP 就是其中之一。它与语言无关,并且具有大多数支持良好的语言的库(和服务器)。
我不能说这是否是最好的解决方案,但我认为这是一个可行的解决方案。它为您提供了点对点、点对多点传输的选项,以及游戏服务器向所有客户端广播的方法。
What you are descibing is not an RMI problem but a messaging one. I am sure there are several solutions you could use, and based on the limited knowledge of your application, I would say that XMPP is one of them. It is language agnostic and has libraries (and servers) available in most well supported languages.
Whether it is the best solution, I couldn't say, but I would think it is a viable one. It gives you the option for transmitting from point to point, point to many points, and a means for your game server to broadcast to all clients.
如果您需要多种语言来调用基于 REST 的 Web 服务,它可能会更容易使用。
A REST based webservice might be easier to use if you need lots of languages to be able to call it.
我总觉得重新发明轮子很乏味。尝试看看是否可以使用 OpenTNL。
I always find reinventing the wheel to be tedious. Try and see if you can use OpenTNL.
许多远程处理基础设施的问题是它们通常不能在框架之间移植。
虽然 XMPP 可能适合您 - 您可能会发现的主要问题是由于发送的数据中的所有标头/存在内容而导致网络上的数据过多。此外,由于 XMPP 是基于 XML 的,因此任何二进制数据都必须作为 Base64 字符串发送。
更好的选择可能是更底层的套接字接口 - 无论哪种方式,能够自由地进行位打包以减少数据大小都可能是有益的。
The issue with many Remoting infrastructures are that they are normally not portable between frameworks.
While XMPP might work for you - the main issue you might find is excessive data crossing the network due to all the header/presence stuff in the data being sent around. Also as XMPP is XML based any binary data would have to be sent around as a Base64 string.
A better bet might be a more low level socket interface - either way having the freedom to do bit-packing to reduce the size of the data will possibly be beneficial.