3 个不稳定版本
| 0.2.1 | 2021 年 4 月 26 日 |
|---|---|
| 0.2.0 | 2021 年 4 月 25 日 |
| 0.1.0 | 2021 年 4 月 24 日 |
#288 in WebSocket
25KB
658 行
Lnkit
Lnkit 是一个用于制作多人 3D 游戏的“粘合”库。它通过 tungstenite 将 rapier & three.js 与 WebSocket 连接起来。
思路是在服务器上运行 rapier3d 物理引擎,并通过 WebSocket 向客户端发送数据。在客户端,WebSocket 消息表现为 three.js 对象。
Lnkit 目前由两个包组成:用 Rust 编写的 服务器 和用 Typescript 编写的 客户端。
这个库的 API 目前有些不便,但将在
v0.3或v0.4中得到改善。
安装
要将服务器包包含在内,请将以下内容添加到 Cargo.toml 的依赖项部分。
[dependencies]
...
lnkit = "0.2.1"
或者直接使用
cargo add lnkit(cargo-edit)
要将客户端包包含在内,请将以下内容添加到 package.json 的依赖项部分。
"dependencies": {
...
"three": "0.x",
"lnkit": "0.2"
}
或者直接使用
yarn add three lnkit或npm install three lnkit
示例
可用的示例在 examples 目录中。
要运行示例,请克隆此存储库,并使用 cargo run --example <example_name 运行服务器,并使用 yarn parcel examples/<example_name>/index.html 运行客户端
依赖项
~16–30MB
~470K SLoC