使用WebSocket构建多人游戏



在此视频中,我演示了如何使用websockets构建可在任何设备上运行的基于浏览器的多人游戏。我使用服务器权威模型设计多人游戏,其中游戏状态存储在服务器上。我将WebSockets用作我正在开发的游戏的通信介质。

连接到服务器:6:00
创建游戏:9:45
加入游戏:13:00
玩游戏:16:00
广播状态18:00
例子22:15
代码31:00
连接代码31:00
创建游戏代码50:00
加入游戏代码59:10
玩游戏代码1:20:40
广播代码1:30:00

源代码

https://github.com/hnasr/javascript_playground/tree/master/websocket-cell-game。

9 comments
  1. Awesome video, thanks! I wonder why does the websocket server rely on the http server and how do they interact with each other. They use the same port so there should be some mechanisms for passing message from one to another?

  2. Great video. One of the best session on Websocket multiplayer game.
    It would be good if you could share the code.
    Waiting for your session on the same working on Multiserver with Redis

Comments are closed.