gRPC可以用于编写实时应用程序,例如多人游戏吗?

huangapple go评论90阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2022年1月15日 01:50:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/70714661.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定