Minecraft for Khan Academy
Khan Academy link can be found here.
GitHub release can be found here.
Replit post and app
Multiplayer login and game. This is the most up-to-date version, and I frequently code in production on this version. Beware of bugs.
Texture encoder is here.
If you'd like to contribute, join the conversation on Discord.
To build the project, first clone/download it, then cd
into the directory, then npm install
, then node index.js
. This will build the project into the dist
folder and start a server on http://localhost:4000. It will watch for any changes in the src folder and automatically re-build the project as soon as you save.
Compiling the caves.c file into WASM is a bit more involved. It requires installing emscripten, then running emcc src/c/caves.c -o test.js -O3 -Os -sEXPORTED_FUNCTIONS=_getCaves -sERROR_ON_UNDEFINED_SYMBOLS=0
, which will output a useless JS file along with the .wasm file. Delete the JS file. Then you'll need to convert the .wasm file to base64 somehow (I just googled an online tool for it), then copy/paste it into the workers/Caves.js file. Loading the wasm file directly works too, but that wouldn't work on KA, which is why I went with the base64 method.
I think there's a way to compile C into WASM with Clang to avoid emscripten and that useless JS file, but I couldn't figure it out. If anyone else figures it out, I'd appreciate some instructions.