问题描述
我一直在寻找一个好的通用二进制网络协议定义框架,以提供一种以多种语言(例如Java后端服务器和iPhone)编写实时游戏服务器和客户端(例如World Of Warcraft或Quake III)的方法.用Objective-C和Cocoa编写的前端客户端).
I've been looking for a good general purpose binary network protocol definition framework to provide a way to write real-time game servers and clients (think World Of Warcraft or Quake III) in multiple languages (e.g. Java backend server and iPhone front-end client written in Objective-C and Cocoa).
我想在Windows上支持Java Flash客户端,iPhone客户端和C#客户端(在XBOX上支持XNA客户端).
I want to support Java Flash clients, iPhone clients and C# clients on windows (and XNA clients on XBOX).
我正在寻找一种通过TCP/IP或UDP套接字流连接有效发送/接收消息的方法.我不是在寻找可以通过HTTP Web服务发送的东西,例如JSON或XML编组对象.尽管Hessian的二进制Web服务协议是一个非常有趣的解决方案
I'm looking for a way to efficiently send/receive messages over a TCP/IP or UDP socket stream connection. I'm not looking for something that can be sent over an HTTP Web Service, like JSON or XML marshalled Objects. Although Hessian's binary web service protocol is a very interesting solution
我想要一种网络协议格式和客户端/服务器基本实现,该协议允许客户端连接到服务器并发送已定义协议中的任何消息并接收该协议中的任何消息,而不必绑定到某种RPC端点.我想要协议中传入和传出的任何消息的通用流.这样一来,我就可以支持服务器每100毫秒向所有客户端发送游戏中各个实体的位置之类的事情.
I want a network protocol format and client/server basic implementation that will allow a client to connect to a server and send any message in the defined protocol and receive any message in the protocol without having to bind to some kind of RPC endpoint. I want a generic stream of any message in my protocol incoming and outgoing. This is so that I can support things like the server sending all clients the positions of various entities in the game every 100 milliseconds.
推荐答案
我发现的网络协议框架如下:
The network protocol frameworks I've found are as follows:
- Google的协议缓冲区-但它不支持发送/接收任意消息之类的功能从您指定的协议中获取.
- Apache Thrift -一个有趣的选择,但主要针对RPC,而不是通用游戏客户端/server套接字类型的连接,客户端或服务器可以在任何时间发送消息,而不仅仅是响应客户端RPC请求.
- Raknet多人游戏-Raknet提供了完整的多人网络库(对于收入低于25万美元的独立开发者,它是免费的)
- Google's Protocol Buffer - but it lacks support for things like sending/receiving arbitrary messages from your given protocol.
- Apache Thrift - an interesting option but it is geared mainly towards RPC instead of generic game client/server socket type connections where the client or server can send messages at any time and not just in response to a client RPC request.
- Raknet Multiplayer - Raknet provides full multiplayer network library (it's free for indie development with revenue under $250k)
更新:OculusVR现在收购了RakNet及其免费/开源.您可以在 Github
UPDATE : OculusVR Acquired RakNet and its Free/OpenSource now. U can find it on Github
- 黑森州二进制Web服务协议-是HTTP Web服务二进制协议,非常适合发送二进制数据,而无需扩展带有附件的协议.
- Hessian Binary Web Service Protocol - is a HTTP web service binary protocol, it is well-suited to sending binary data without any need to extend the protocol with attachments.
Raknet提供了一个很好的面向游戏/模拟的多人游戏库.
Raknet provides a good game/simulation oriented multiplayer library.
Apache Thrift和Google的协议缓冲区似乎是在游戏网络协议客户端/服务器体系结构中使用的最简单方法.
Apache Thrift and Google's protocol buffers seem to be the simplest approaches to using in a game network protocol client/server architecture.
如果您想使用 COMET . Hessian可能会提供一种非常有趣的方式来支持Web上的实时游戏,甚至能够将其托管在VM Web解决方案(例如Google的App引擎或Amazon的EC2)上.
Hessian seems like a great fit if you want to create a web based game server with a Java or flash client using some type of server push technology like COMET. Hessian might provide a really interesting way to support real-time games on the web and even be able to host them on VM web solutions like Google's App engine or Amazon's EC2.
关于在游戏和其他用途中使用各种协议定义框架的一些讨论:
There's some discussion about using various protocol definition frameworks for games and other uses:
- 各种序列化框架的比较
- 节俭与协议缓冲区-节俭被宣布为更好的框架,因为它具有完全受支持的RPC客户端/服务器实现
- 为客户端服务器游戏使用协议缓冲区API确定要解码的消息类型
- 使用节俭的双向RPC
- Comparison of Various Serialization Frameworks
- Thrift vs Protocol Buffers - Thrift is declared the better framework because it has a fully supported RPC client/server implementation
- Using Protocol Buffers for client server Game API determining what type of message to decode
- Bi-Directional RPC using thrift
这篇关于可用的游戏网络协议定义语言和代码生成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!