英文:
Can gRPC be used to write realtime applications like multiplayer games?
问题
最近,我一直在阅读关于Google的gRPC的内容。我想知道它是否适合用于实时应用,比如多人游戏。
例如,我们能否使用gRPC构建一个实时多人游戏的游戏服务器?
英文:
Lately, I've been reading about Google's gRPC. And I am wondering if it's a good choice for a real-time application like a multiplayer game.
For instance, can we build a game server with gRPC for a real-time multiplayer game?
答案1
得分: 7
你可以使用实时多人游戏,但通常情况下,UDP比TCP更适合流媒体传输,因为TCP可能由于重新排序和数据包确认等特性而导致较高的延迟。
gRPC使用的是基于TCP的HTTP/2协议,这在某些情况下可能不适用。
然而,这并不妨碍你使用gRPC所使用的消息序列化工具——Protocol Buffers,如果这是你喜欢的功能的话。
英文:
You can, however, real-time multiplayer games usually prefer UDP over TCP for streaming because TCP can have a lot of latency due to features like reordering and packet acknowledgement.
gRPC run uses HTTP/2 which used TCP, which would make it unsuited in some cases.
This however doesn't stop you from using protocol buffers which is the message serialization used by gRPC, if that is a feature you like.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论