Clap
3D game engine in plain C
Install / Use
/learn @virtuoso/ClapREADME
CLAP game engine

Index
- Live demos and executables
- Native demo executables
- Source code and submodules
- Local build (Macos)
- Linux build
- Wasm build
- Windows build
- Build using cmake presets
- Build errors
- What to do with all this
Live demos and executables
There are 2 live demos that build from this repository: a testbed of sorts -- a place for wild experiments and Towards the Light, a game made for Ludum Dare 57 game jam.
The complete list of all executables/packages/web builds from all branches and tags is here.
Built from the "main" branch
| platform | testbed release build | testbed test build | ldjam57 release build | ldjam57 test build | | -------- | --------------------- | ------------------ | --------------------- | ------------------ | | web | clap | claptest | ldjam57 | ldjam57 test | | linux x86_64 | clap | claptest | ldjam57 | ldjam57test | | Mac OS X arm64 | clap | claptest | ldjam57 | ldjam57test | | Windows x64 | clap | claptest | ldjam57 | ldjam57test |
The windows executables are cross-built on linux using MinGW. There are also native windows builds: clap, ldjam57
Built from the "testing" branch
These are more for development-curious.
| platform | testbed release build | testbed test build | ldjam57 release build | ldjam57 test build | | -------- | --------------------- | ------------------ | --------------------- | ------------------ | | web | clap | claptest | ldjam57 | ldjam57 test | | linux x86_64 | clap | claptest | ldjam57 | ldjam57test | | Mac OS X arm64 | clap | claptest | ldjam57 | ldjam57test | | Windows x64 | clap | claptest | ldjam57 | ldjam57test |
Source code and submodules
Checkout repository and modules
git submodule update --init --recursive
Local build (Macos)
Install dependencies
brew install cmake zlib libpng libogg libvorbis freetype glfw shaderc spirv-cross pkg-config
Build
./configure.sh
./build.sh
Run
Optionally, you can run a server that collects logs from all instances of the engine client for debugging purposes. If you don't specify "server_ip" in the build_config configuration file, or don't specify -DCLAP_BUILD_NETWORKING during cmake configuration stage, you don't have to run the server. Otherwise, set "server_ip" to the IP address of the machine where the server will be running.
build/debug/tools/server/server
And run the demo
build/test/demo/ldjam56/ldjam56
Linux build
Install dependencies (see also the simple-build.yml in case this goes out of date):
sudo apt-get install -y libfreetype-dev libglfw3-dev libogg-dev libopenal-dev libpng-dev libvorbis-dev zlib1g-dev glslc spirv-cross
The rest is the same as the Mac OS build instructions
Wasm build
Install some of the dependencies needed for native build: cmake, shaderc/glslc, spirv-cross. See Mac OS build or Linux build, depending on your host operating system for details. The rest of the dependencies will be brought in by emsdk.
Emscripten
Download and install Emscripten
Create build_config file
emsdk_env_path=<path to installed emscripten SDK>
www_dir=<path to www build folder where static content will be build>
See Run section about the server_ip=... setting.
For example:
emsdk_env_path=${HOME}/src/game/emsdk/emsdk_env.sh
www_dir=${HOME}/src/game/www
Run local web server
To serve wasm builds, you'll need https capable server, because otherwise the browsers refuse (among other thing) to spawn web workers, which are now required for audio. There is a tiny http server in the source tree that will generate a self-signed SSL certificate and use it to serve wasm builds. It can be run like this:
tools/httpd/httpd.py --autocert --dir ${HOME}/src/game/www
Windows build
Ok, are you sure? Yes? Read on. For reference, check windows-build github action.
First, install Visual Studio 2019 Community edition (free). VS 2022 doesn't work yet, because of conflicts with windows-libc, somebody will fix it eventually.
Then, install LLVM for clang. There's also a way of installing clang via Visual Studio, but this one is easier.
Then, install python.
Then, set up vcpkg and set an environment variable to the path of the cloned repository:
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat -disableMetrics
export VCPKG_INSTALLATION_ROOT=.../vcpkg
Note: everything up to this point is preinstalled in github runners, so windows-build.yml doesn't mention any of that.
Then, install all the dependencies using vcpkg:
$VCPKG_INSTALLATION_ROOT/vcpkg.exe libpng:x64-windows-static glfw3:x64-windows-static freetype:x64-windows-static openal-soft:x64-windows-static libogg:x64-windows-static libvorbis:x64-windows-static shaderc spirv-cross
Then, in the root of the clap directory, configure and build using cmake. Use --parallel X option with cmake --build commands to speed things up.
cmake --preset w32test -B build/test
cmake --preset w32debug -B build/debug
cmake --build build/test
cmake --build build/debug
Then, run the result:
.\build\test\demo\ldjam56\ldjam56.exe
Build using cmake presets
Windows build is an example of how to build using cmake presets (w32test, w32debug). These two require VCPKG_INSTALLATION_ROOT environment variable to point to vcpkg root.
Wasm build can be done similarly, setting EMSDK to point to the Emscripten installation root. Having done that, you can do one or several of the cmake presets:
cmake --preset emtest -B build/emtest
cmake --build build/emtest
What to do with all this
Check out the brand new CONTRIBUTING file for details on the whats and the hows. If you're using Visual Studio Code, here is a copy-pastable configuration for the project to get you up and running.
Related Skills
node-connect
331.7kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
81.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
331.7kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
81.6kCommit, push, and open a PR
