[toc] # Background ドクター让我多调研一下沙盒游戏的方案,一想到沙盒游戏,那第一映入脑海的显然就是 Minecraft 与 Terraria(我完全没有接触过 Roblox ...)。 仔细观察了一下 Minetest 的完成度和质量非常之高,社区也非常活跃。 更重要的是,它的引擎代码是 cpp,和 easyrpg 一样,那么也就意味着它也同样有机会可以使用 emscripten 编译到浏览器中运行。 https://blog.minetest.net/2022/03/27/March/ ## 需要实现的特性 - [x] 开宝箱 - [x] 获得 NFT 空投 - [x] 预装 mod - [ ] 使用 w3itch 的账号系统 - [ ] 通过浏览器参数自动连接特定服务器(例如 https://api.w3itch.io/minetest/?address=mtn.kuso.io&port=30000&account=minakokojima&pwd=blabla) - [ ] 保留已安装 mod ## 如何编译客户端代码 Minetest-Wasm https://github.com/paradust7/minetest-wasm 最主要的难点是安装 emscripten,但是因为之前编译 [ynoclient](https://github.com/ynoproject/ynoclient) 有做过,我们直接沿用即可。 `source ~/workdir/buildscripts/emscripten/emsdk-portable/emsdk_env.sh` ### 拷贝到本地 `scp -r ubuntu@api.w3itch.io:~/tt/minetest-wasm/www C:/Users/25181/Documents/GitHub/minetest-wasm/` `sudo cp ~/tt/minetest-wasm/www/minetest.data ~/tt/minetest-wasm/www/minetest.js ~/tt/minetest-wasm/www/minetest.wasm ~/tt/minetest-wasm/www/minetest.worker.js /home/w3itch-testing/w3itch-backend-testing/thirdparty/minetest/` ## 如何与浏览器交互 ### 一个例子 比如把玩家的聊天内容输出到 console。。。 https://github.com/minetest/minetest/blob/master/src/client/client.cpp#L1244 那么只要在头文件 `#include "emscripten.h"` 然后 `EM_ASM(console.log(123));` 即可。 ## 其它问题 git clone -b webport "https://github.com/lychees/minetest.git" 我现在用自己的 repo 会报 https://stackoverflow.com/questions/63240844/cmake-not-able-to-find-x11-package 原因不明
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up