[英]Lance.gg in multiplayer html5 game does not sync
I'm trying to make a multiplayer game in HTML5
. 我正在尝试
multiplayer game in HTML5
制作multiplayer game in HTML5
。 I found lance.gg and play around. 我找到了lance.gg并且玩耍。 I modified the Pong game like this.
我像这样修改了Pong游戏。
(0, 0.1)
(0, 0.1)
Ball.velocity.y = -3
each time keyboard input space bar Ball.velocity.y = -3
And here is result https://youtu.be/MmQOqR71Df0 . 这是结果https://youtu.be/MmQOqR71Df0 。 As you can see, it does not really sync over the window.
正如您所看到的,它并没有真正在窗口上同步。 How can I make it move smoothly between many players?
如何让它在众多玩家之间顺利移动?
The Ball.js
class defines the following getter: Ball.js
类定义了以下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. 将
bendingVelocityMultiple
设置为零可能在其他情况下很有用,例如,如果您想在球员输球时将球移回中心。
Take a look at the documentation for GameObject 看一下GameObject的文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.