Mutli Player Game synchronization

后端 未结 3 2109
深忆病人
深忆病人 2021-02-04 17:03

The Situation:

I would like to ask what\'s the best logic for synchronizing objects in a multiplayer 1:1 game using BT or a web server. The game has two players, each o

3条回答
  •  眼角桃花
    2021-02-04 17:35

    since the bullets on one device may be faster than other

    This should not happen if the game has been architected properly.

    Most games these days (particularly multiplayer ones) work on ticks - small timeslices. Each system should get the exact same result when it computes what happened during a tick - no "bullets moving faster on one machine than they do on another".

    Then it's a much simpler matter of making sure each system gets the same inputs for each player (you'll need to broadcast each player's input to each other player, along with the tick the input was registered during), and making sure that each system calculates ticks at the same rate.

提交回复
热议问题