Following along with the YouTube series.
Install
-
direnv
brew install direnv
-
cmake
brew install cmake
-
# Install cd /opt git clone https://github.com/emscripten-core/emsdk.git cd /opt/emsdk
# Update to latest version cd /opt/emsdk git pull ./emsdk install latest ./emsdk activate latest
# .zprofile export EMSDK_HOME=/opt/emsdk source $EMSDK_HOME/emsdk_env.sh > /dev/null 2>&1
-
Conan package manager -
brew install conan
-
Copy minecraft files...
# Show available versions of minecraft on a mac bin/minecraft-extract # Extract specific version of minecraft bin/minecraft-extract 1.18.1
# libc++ vs stdlibc++ might depend on platform...
# https://stackoverflow.com/questions/14972425/should-i-use-libc-or-libstdc
# Install
conan install . -s build_type=Debug -s compiler.libcxx=libc++ -s cppstd=20 --install-folder=build --build missing
cd build && cmake .. && cmake --build .
# optional...
# This will use the assets in the project instead of relying on cmake to copy.
# This avoids being confused when you change a shader and nothing happens.
# BLOCKWORLD_ASSETS_PATH=$(pwd)/client/assets
# Run app...
bin/blockworld
# Release dependencies
# conan install . -s build_type=Release -s compiler.libcxx=libc++ -s cppstd=20 --install-folder=cmake-build-release --build missing
Uses Experimental Features: WebAssembly Roadmap
- Exceptions (Chrome, In progress: Firefox, No: Safari) - We just have to deal with crashes until this is supported
- Threads and atomics (Chrome, Firefox, In progress: Safari) - Not used yet, but we will want to...
- WebGPU
conan install . -s build_type=Debug -s compiler.libcxx=libc++ -s cppstd=20 --install-folder=build-wasm --build missing
cd build-wasm && emcmake cmake .. && cmake --build .
# Run app...
npx http-server bin # This assumes node is installed...
open http://127.0.0.1:8080/blockworld.html
#emcc src/main.cpp -o cmake-build-wasm/index.html -Iinclude -s USE_WEBGL2=1 -s USE_GLFW=3 -s WASM=1 -std=c++20 -fwasm-exceptions
- roadmap
- zero cost exceptions
- -fwasm-exceptions (enable wasm exceptions)
- -s DISABLE_EXCEPTION_CATCHING=0 (is this old?)
# Install conan dependencies
conan install . -s build_type=Debug --install-folder=build-cmake-debug --build missing
# dont do below, click on that conan install at the bottom and then reload the cmake project in the ide
#cd cmake-build-debug && cmake ..
Install the following plugins, then follow compile directions.
- C/C++ for VSCode
- CMake Tools for VSCode
- Clang-Tidy for VSCode
- Conan for VSCode
- Visual Studio Code - Get started with CMake Tools
- clang-tidy, clang-format:
brew install llvm
- Definitive Guide to Creating a Window | How to Code Minecraft Ep. 1
- setup on mac. need to code sign?
- Faithful 1.18 Resource Pack
- Better way to handle opengl resources
- glTF 2.0 Overview
- Gaffer on Games - Fix your timestep
- Minecraft Clone
- Learn OpenGL
- WebGL2 fundamentals
- clang-tidy list of checks
https://en.cppreference.com/w/cpp/compiler_support
- glfw - GL windowing library: zlib/libpng License
- glad - GL bootstrap: MIT License
- glm - GL Math: The Happy Bunny License or MIT License
- tinygltf - GLTF file loading: MIT License
- stb - image processing: MIT License or Public Domain
- Modify cmake to recompile for asset change
- per vertex data... make vertex color use rgba=4bytes instead of 4 floats
- Block map... load all available blocks in the minecraft models folder.
- cull faces
- https://github.com/SRombauts/SimplexNoise
- TextureArray (Bug in m1 mac that causes it to fail)