我正在开发一款多人游戏。我打算通过 HTTPS 交换所有数据,但它太慢了。SSL 握手的高延迟网络需要超过一秒钟的时间。虽然游戏是回合制的并且不需要超快的数据传输,但 1000-2000 毫秒的 ping 仍然是不可接受的。
我可以使用哪些协议/方法以尽可能低的延迟安全地传输数据?
编辑:只是为了回应您对有效载荷的询问,这是一个单位攻击敌方建筑物的结果(显然我没有发送一串 1 和 0,这只是一个二进制表示):
00000000 10010011 01010001 00100011 01011100 01010001 01010000
消息细分:
00000000 client's request executed with status "OK", other values correspond to specific error messages.
10 Object is owned by Player 2
010 Object is a building
0110 Object is located at x=6 (always 0<=x<=14)
101 Object is located at y=5 (always 0<=y<=6), owner and location is sufficient to describe any object uniquely
0001 1 byte-worth of modified attributes follows
0010 0011 Object's health is now 3
01 Object is owned by Player 1
011 Object is a unit
1000 Object is located at x=8
101 Object is located at y=5
0001 1 byte-worth of modified attributes follows
0101 0000 This object can no longer move/attack this turn
我认为我不能在不增加 CPU 成本的情况下获得更多的数据密度。