使用 tcp、udp 组合的棋盘游戏服务器好主意吗?
我正在使用 Netty 编写棋盘游戏服务器。在游戏的每个部分都使用 TCP。但我大多数时候都会遇到问题。尽管已经发布了几个问题,尝试了许多配置参数,但我仍然遇到问题(最多是延迟和意外断开连接问题)
我的想法是,在访问者玩游戏时使用 TCP。除此之外,如果您正在探索房间、查看桌子、寻找朋友等,则会使用 UDP。我可以期待性能提升吗?
服务器:JAVA、Linux 客户端:Adobe Flash
I am coding board game server using Netty. Using TCP at every part of the game. But I am having issues most of the time. Even though have posted several questions, tried many configuration parameters, I am still having issues (latency and un-expected disconnect issues at most)
My idea is, using TCP while visitors playing the game. Other than this, if you are exploring rooms, checking tables, looking for friends etc. will use UDP instead. Can I expect performance increase ?
Server: JAVA, Linux
Client: Adobe Flash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,因为最终您将不得不考虑那些未到达目的地的 udp 消息。如果我知道我的朋友正在玩,而当我搜索朋友时他没有出现,我就会重新运行搜索。
如果您确实有太多流量(这对于棋盘游戏服务器来说似乎很奇怪),您始终可以将不同的功能隔离到不同的服务器。例如,一台服务器可以专用于聊天,另一台服务器专用于大厅,另外 3 台服务器专用于运行游戏。
No, because in the end you will have to account for those udp messages not getting where they are going. If I know my friend is playing and when I search for friends he doesn't come up, I'll just run the search over again.
If you truly have too much traffic (which seems bizarre for a board game server) you can always isolate different functionality to different servers. For example, one server could be dedicated to chat, another to lobbies, and another 3 to running games.
在相关说明上。这是一个 netty 游戏服务器,它在同一存储库中有一个 as3 客户端。它也支持UDP,但你需要使用Java/C其他语言客户端,而不是flash。
On a related note. Here is a netty game server which has an as3 client in the same repo. It also support UDP but you need to use Java/C other language client, not flash.