Home  >  Q&A  >  body text

socket - java 坦克大战多人联机里面如何进行数据的交互

自己打算用java做个联机版的坦克大战,但是在联机一块卡住了
效果差不多就是:1个服务端,然后很多客户端连接过来,实现多人联机
但是问题来了,首先里面有子弹集合,各种坦克的坐标,我该如何用socket进行传输
就算传输了过去,服务端又如何进行分辨,哪些数据是描述坐标的,哪些数据是描述炮弹的
请大家支个招,给个思路

大家讲道理大家讲道理2765 days ago537

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:17:37

    I have written the backend of VR products before. The simplest solution is:

    • The server is responsible for distributing data

    • Select a host in the client to complete the calculations of the physics engine and then distribute it to the sub-clients

    • The sub-client only synchronizes and receives data, but does not perform calculations.

    reply
    0
  • Cancelreply