我正在尝试制作multiplayer game in HTML5
。我找到了lance.gg并且玩耍。我像这样修改了Pong游戏。
(0, 0.1)
Ball.velocity.y = -3
这是结果https://youtu.be/MmQOqR71Df0。正如您所看到的,它并没有真正在窗口上同步。如何让它在众多玩家之间顺利移动?
答案 0 :(得分:1)
The Ball.js
class defines the following getter:
get bendingVelocityMultiple() { return 0.0; }
This instructs the client to ignore the server's velocity updates. The result is that the client and server velocities fall out-of-sync, and results in the video you captured.
If you set instead:
get bendingVelocityMultiple() { return 0.8; }
Then the problem will go away. Having bendingVelocityMultiple
set to zero might be useful in other cases though, for example if you want to transplant the ball back to the center when a player has lost.