不知道发数码区还是游戏区,问下游戏协议问题

  • l
    lucifer890
    是的,udp效率高
  • l
    lucifer890
    TCP是先握手,建立连接,然后发送和接收数据,但是中间如果出问题了就需要重新建立连接,然后再进行数据传输,
    如果中间数据有丢失,那么处理起来其实和UDP协议是一样的。
    那么我为什么不用UDP呢,不需要建立连接,你发就是了,我这边接收就行。
  • 火星观光团团长
    作为游戏服务器开发,更多选择tcp
  • b
    breeze7086
    别人的不知道,自己公司的游戏协议是tcp
    大部分的也应该都是tcp
  • b
    b0207191
    你公司是做什么游戏的?


    Although TCP is generally considered to be unsuitable for
    interactive and real-time communications, many MMORPGs
    adopt it as their underlying transport protocol. One reason
    is that TCP is stream-oriented, so that the message stream
    at the sender will be identical to the stream received at the
    destination. This property allows game developers to focus
    on game development, and leave issues related to network
    transmission to TCP. However, TCP can degrade message
    transmission efficiency because the stream-oriented feature
    is not required for each game message exchange; hence the
    protocol’s in-order and reliable delivery might lead to overkill
    sometimes.
  • j
    jiejieup
    具体还是看需求,实时性要求低的用tcp也可以。 udp 限制多,可能需要找个开源库。
  • l
    lobydenk
    udp要做分包(兼顾不同客户网络的最大包尺寸) 丢包重发 还要排序重组 ,这些都是在程序代码上做的 和tcp问题粒度完全不同,
    tcp故障基本是事务基本重置, 逻辑清晰, 如果你只是用别人做好的库去收发一下东西,那udp tcp就没什么好比较了,
    现在游戏还会直接用https协议,通常是看使用场景,数据资料类的用高级协议, 运行时数据,本身就比较小的数据用udp,比如实时状态更新,视频(也有tcp),
  • 吥喓遺莣
    有些奇葩国家的网络把udp封了,如果楼主想做游戏,建议至少支持TCP
  • b
    breeze7086
    mmorpg,传统回合制
    有些非实时的,会使用http,支持热修复,有事务性
    udp的使用不太清楚,可能小公司比较低端