多人游戏中的动作同步
我正在玩一个简单的演示,我可以在环境中以第一人称的方式走动。我使用 Three.js 来实现这一点。
我希望能够在该玩家加入时生成另一个玩家,并能够同步两个玩家的动作,以便他们可以看到彼此在地图上移动。生成玩家不是问题,但同步每个玩家的移动以便他们能够看到彼此才是问题。
我主要是一名网络开发人员,所以我不知道从哪里开始有效地做到这一点。我想将每个玩家的位置存储在像 mysql 这样的数据库中,还是可以使用 node.js 以某种方式更有效地存储在内存中?如果有人知道任何好的资源或者有任何意见或建议,我将不胜感激。
I am playing with a simple demo where I can walk around in first person in an environment. i used three.js to achieve this.
I want to be able to spawn another player when that player joins and be able to synchronize the motion of both player so they can see eachother moving around the map. Spawning the player is not an issue, but synchronizing each of the player's movement so they can see eachother is.
I am primarily a web developer so I do not know where to start in doing this efficiently. Would I want to store the positions of each player in a database like mysql or can it be more efficiently stored in memory somehow using node.js? If anyone knows any good resources or has any comments or suggestions, I would greatly appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用node.js和socket.io的组合来让不同的玩家彼此实时通信。
这是一个有点类似的问题,也许可以帮助您指明正确的方向:
https://gamedev.stackexchange.com/questions/13207/multiplayer-html5-节点js-socket-io
you can use a combination of node.js and socket.io to let the different players communicate with each other in real time.
here's a somewhat similar question which can maybe help to point you in the right direction:
https://gamedev.stackexchange.com/questions/13207/multiplayer-html5-node-js-socket-io