This is a heavily vibe-coded fork of openblack to gauge what development challenges lie ahead. If you wish to contribute, please help upstream.
openblack is an open source reimplementation of Black & White (2001) written in modern C++20, with bgfx for the renderer (Direct3D, Vulkan, Metal, OpenGL and WebGPU) and EnTT for the game state.
You still need to have the original game assets in order to use this. See further below for an explanation on how to extract them.
Each square is one or more rows of the progress lists, which break each domain of the game into the behaviours of the original game (snapshot of 2026-11-23); tools/progress_map.py draws the map.
For the latest build of upstream openblack without having to build it yourself, upstream offers pre-built binaries from its test service. These builds do not have the work of this fork.
The following are qualified as exprimental. They have base minimum setup such as compilation and rendering system. Don't expect to be able to launch without some effort and your own patches.
Clone the code with its submodules: git clone --recursive https://github.com/openblack/openblack.git (use the URL of
this fork to get its code).
If you forgot to add --recursive, run git submodule update --init in the openblack/ directory. The only submodule
is vcpkg, which gets and builds the dependencies.
You need:
- CMake 3.20 or later (the presets file needs it) and Ninja.
- A C++20 compiler: MSVC 2022 on Windows, GCC 13 or Clang on Linux, Apple Clang (Xcode) on macOS.
- Python 3 for the tests that are scripts and for some build steps.
- For the web build only: Emscripten.
The easiest way to start on any platform is to let CMake and vcpkg get all the dependencies. Select a preset in your IDE, or use the command line:
cmake --list-presets
cmake --preset ninja-multi-vcpkg
cmake --build --preset ninja-multi-vcpkg-debug
The first configure builds all the dependencies with vcpkg, which takes some time. The programs go to bin/ in the
build folder.
| Preset | What it builds |
|---|---|
ninja-multi-vcpkg |
Ninja Multi-Config with vcpkg, for Windows, Linux and macOS. The usual preset for developers. |
msvc-17-vcpkg |
A Visual Studio 2022 solution with vcpkg. |
xcode-vcpkg |
An Xcode project with vcpkg (macOS). |
unix-makefile-vcpkg |
Unix Makefiles with vcpkg. |
emscripten-vcpkg |
The web build (WebAssembly), see Web. |
ninja-multi-vcpkg-shipping, msvc-17-vcpkg-shipping, emscripten-vcpkg-shipping |
The builds that players get: the same as the preset above, but with OPENBLACK_DEVELOPER_TOOLS off. The web shipping build also writes its debug information to a separate file. |
linux-system-deps |
Linux with the libraries of the system, not vcpkg (for packagers). |
android-*-vcpkg, ios-*-vcpkg, ios-xcode-vcpkg |
Android and iOS. These are experimental. |
Each configure preset has build presets for its configurations, for example ninja-multi-vcpkg-debug and
ninja-multi-vcpkg-release.
| Target | What it is |
|---|---|
openblack |
The game. Give it the game folder with -g (see the game data). |
openblack-server |
The dedicated server of a network game: one land, no window. It builds with the desktop presets (not for Android or the web). |
openblack_tests |
The unit tests (GoogleTest). |
packtool, l3dtool, lndtool, anmtool, glwtool, morphtool, camtool, binktool, datatool, lhvmtool, creaturemindtool |
Tools that read, show and write the file formats of the game. Their readers are in components/. |
creatureupload |
The desktop tool that uploads a creature. |
Useful switches of the game: -g <folder> (the game folder, required), -b <backend> (Vulkan, D3D12, D3D11, GL,
Metal or Noop), -m <mode> (the window mode), -n <frames> (stop after this number of frames). Run
openblack --help for the full list.
vcpkg gets these from vcpkg.json. The vcpkg version is the commit of the vcpkg submodule.
| Library | What openblack uses it for |
|---|---|
| bgfx | The renderer: Direct3D 11 and 12, Vulkan, Metal, OpenGL, and WebGPU in the web build. Its shaderc tool compiles the shaders on the host. |
| EnTT | The entity component system, the service locator and the resource caches. |
| SDL2 | The window, the input and the platform layer (X11 and Wayland on Linux). |
| glm | Vector and matrix maths. |
| spdlog | Logs. |
| Dear ImGui | The debug windows and the editor. |
| OpenAL Soft | Sound output. |
| dr_libs | The decoders of the WAV and MP3 sound files. |
| stb | Image reading and writing. |
| cxxopts | The command line switches. |
| minizip | The compressed files of the game (.zzz), through its zlib. |
| curl | The lobby client and the downloads on the desktop and the server (with OpenSSL and web sockets). The web build uses the fetch of the browser. |
| sentry-native | The error and crash reports (OPENBLACK_SENTRY). Desktop and server only. |
| GoogleTest | The unit tests. |
The project also has:
vcpkg-overlay-ports/: changed ports of bgfx (fixes for the Direct3D 12, Vulkan and WebGPU back ends), glm (the same order of operations in dot products on all platforms), libunwind (a fixed source archive) and sentry-native.web/ports/andweb/triplets/: the ports of SDL2 and OpenAL Soft and the vcpkg triplet of the web build.externals/: nlohmann JSON and the extra widgets of Dear ImGui.
| Option | Default | What it does |
|---|---|---|
OPENBLACK_USE_VCPKG |
on with Visual Studio, else off (the vcpkg presets set it) | Get the dependencies with the vcpkg submodule. |
OPENBLACK_DEVELOPER_TOOLS |
on | The debug windows, the editor, the inspector, the test scenarios and the debug keys. The shipping presets set it off. |
OPENBLACK_INSPECTOR |
on, but off in Release, Android and web builds | The debug inspector: a local server (--inspect-port) that tools use to query and control the game. |
OPENBLACK_SENTRY |
on, but off on Android and iOS | Send error and crash reports to Sentry. The game sends them only when the player turns on the option. OPENBLACK_SENTRY_DSN gives the DSN; keep it out of the repository. |
OPENBLACK_BINK_DECODER |
on | Play the Bink videos of the game. |
OPENBLACK_WEB_DEBUG_INFO |
off | Web build: write the debug information to a separate file. |
OPENBLACK_SANITIZE |
empty | Build with sanitizers, for example address,undefined. |
OPENBLACK_WARNINGS_AS_ERRORS |
off | Treat warnings as errors. |
OPENBLACK_CLANG_TIDY_CHECKS |
off | Run clang-tidy during the build. |
OPENBLACK_TRACE_TIME |
off | Compile time analysis (Clang only). |
- Install Visual Studio Code
- Install the C++ Extension
- The extension might not be required on Linux
- Install a compiler depending on your platform
- GNU or Clang compilers on Linux
- Visual Studio's MSVC on Windows (See Visual Studio)
- Clang compiler on Mac
- Install the CMake Tools Extension
- Install CMake version 3.20+
- You can simply open the
openblackfolder directly in Visual Studio Code and select a preset.
- Install Visual Studio
- Select an appropriate MSVC C++ Component for your version
- Select an appropriate Windows SDK Component for your version
- Select the C++ CMake tools for Windows Component
- You can simply open the
openblackfolder directly in Visual Studio and select a preset.
- Install Clion
- You can simply open the
openblackfolder directly in CLion and select a preset.
- Install XCode
- Install the homebrew dependencies using homebrew:
brew install cmake ninja pkg-config - Run
sudo xcode-select --resetafter installing cmake - You need to configure using the cmake preset
xcode-vcpkgusing cmake in either the GUI or using the command line argument--preset xcode-vcpkg
- Your usual build tool-chain.
- Ubuntu / Debian:
# apt install build-essential cmake ninja-build - Arch Linux / Manjaro:
# pacman -S base-devel cmake ninja
- Ubuntu / Debian:
- You can generate the cmake build preset using
cmake --presetand you can list the presets usingcmake --list-presets
The web build runs the game in a browser. The game draws with WebGPU, or with WebGL 2 when the browser has no WebGPU. The game runs on a worker thread and uses JSPI (JavaScript Promise Integration) to wait for the browser. Thus it needs a browser with JSPI. For Safari, use version 27 or later. There is no build without JSPI.
- Get emsdk, then run
emsdk install latestandemsdk activate latest. - Set the
EMSDKenvironment variable to the emsdk folder. - Configure and build the
emscripten-vcpkgpreset (oremscripten-vcpkg-shippingfor players). - The page is in
web/page. The player gives the game folder from the disk on the page; the build has no game data. - The game threads need the COOP and COEP headers. To test on your computer, serve the output folder with
python web/scripts/serve.py <folder> <port>, which sends them.
openblack-server is the dedicated server of a network game. It is part of the desktop presets. To build only the
server on Linux for a host, use the shipping preset:
cmake --preset ninja-multi-vcpkg-shipping
cmake --build --preset ninja-multi-vcpkg-shipping-release --target openblack-server
The server also needs the game data (-g). Run openblack-server --help for its switches, for example --lan for a
game on the local network.
The Android build is experimental.
- Install Android Studio
- Install a recent SDK and an NDK of at least 23
- Open openblack from the
androiddirectory - Set the SDK and NDK in the project settings
- Do gradle configure which will run cmake configuration and compile the vcpkg dependencies
- Build the project for either a virtual device or a connected device
- Currently requires user to upload game assets to
/data/local/tmp/bwandchmod -R a+wrx /data/local/tmp/bwwith adb
The build makes the tests when CMake finds GoogleTest (vcpkg gives it) and the build is not a cross compile. Run them with CTest:
ctest --preset ninja-multi-vcpkg-debug
ctest --test-dir <build folder> -C Debug -R creature
-R runs only the tests whose names match. Some tests are Python scripts; CTest runs them when CMake finds Python 3.
The tests do not need the game data. A small number of tests use the game data when the environment variable
OPENBLACK_GAME_PATH gives the game folder, and skip without it.
Test code can read freed memory and still pass on some test orders. To find this, build the tests with sanitizers in a
separate Debug build folder (Clang or GCC; MSVC supports only address):
cmake -G Ninja -S . -B build-asan -DCMAKE_BUILD_TYPE=Debug -DOPENBLACK_SANITIZE=address,undefined <your usual options>
cmake --build build-asan --target openblack_tests
cd build-asan/test && ../bin/openblack_tests && ../bin/openblack_tests --gtest_shuffle --gtest_random_seed=1
Run the program plain and shuffled. Any report from a sanitizer is a bug to fix. The option is off by default and does not change the normal builds.
If you don't want to use vcpkg; CMake will use system libraries, or manually specified package directories.
CMake will find the required libraries as long as they provide a proper config file.
Install openblack-git from the AUR which builds and installs directly for all Arch Linux derived distros such as Manjaro. This will require pacman to install all required dependencies.
The preset to use is "linux-system-deps" - Linux (System Deps)
Contributions are always welcome, whether it's modifying source code to add new features or bug fixes, documenting new file formats or simply editing some grammar.
You can also join the Discord for development discussion if you are unsure of anything.
All C++ code must match clang-format 17 (the file .clang-format). Other versions of clang-format format some
lines differently, so use version 17.
The repository has two hooks. sh tools/githooks/install.sh installs both:
pre-commitchecks the staged lines of C++ files insrc,apps,componentsandtest. It does not check lines that you did not change. If a line does not match, the commit stops and the hook prints the command that fixes it.pre-merge-commitchecks every C++ file that a merge changes, as whole files.
On Windows PowerShell, run the script with Git Bash:
& "C:\Program Files\Git\bin\sh.exe" tools/githooks/install.sh. The script puts the hooks in the common git
folder, so they apply to all worktrees of the repository. If a different hook is already there, the script saves it
as <name>.bak.
The hooks look for clang-format 17 in this order:
- The environment variable
OB_CLANG_FORMAT_DIR. It names the folder that holdsclang-formatandgit-clang-format. - The git setting
openblack.clangFormatDir(git config --global openblack.clangFormatDir <folder>). - The value
tools.clangFormat17Dirin.claude/openblack.local.json. clang-format-17orclang-formatonPATH.
To get clang-format 17, run python -m pip install --target <folder> clang-format==17.0.6.
After the format check, pre-commit also runs clang-tidy 17 on the staged lines. A finding on a changed line stops the
commit. A NOLINT needs a check name and a reason comment. The settings and the fix steps are in
tools/githooks/README.md.
As mentioned before, the original game assets are required in order to run openblack. Since these data are copyrighted, we won't provide them, so please don't ask. Here is a guide for extracting them from the original game.
You will need the following:
- The original installer (usually on a CD)
- Official patch 1.10
- Official patch 1.2
- Not needed (but will not compromise the extraction): Unofficial patch 1.42
Do not install 1.3, it is a patch to add P5 Power Glove support and is generally unstable
- Install the game from the installer, remember the installation directory
(
C:\\Program Files (x86)\\Lionhead Studios\\Black & White\\is the default) - Install the official patch 1.10 (in the same directory)
- Install the official patch 1.2 (in the same directory)
If you run on Linux or macOS, you can install the game with Wine (App Page on WineHQ).
- Install
wine - Run
wine Setup.exefrom the directory containing the installer, don't change the install path - Run
wine Black_White_Patch_v1.100.exefrom the directory containing the first patch (adapt the command in case the filename isn't exactly that) - Run
wine black_white_patch_v1_20.exefrom the directory containing the second patch (adapt too) - In case you would like to install the unofficial patch, it requires .NET 2.0,
that can be installed with
winetricks dotnet20sp2(you should installwinetricks first)
All the files should be installed in the following directory:
~/.wine/drive_c/Program Files (x86)/Lionhead Studios Ltd/Black & White
The folders you're interested in are the Audio, Data and Scripts folders in the
installation directory. You can use them from there or make a copy to the
location of your choice.
If you want to use them from there, remember the installation directory chosen in the installation step, unless you changed it, it should be either:
- either
C:\\Program Files (x86)\\Lionhead Studios\\Black & White\\ - or
~/.wine/drive_c/Program Files (x86)/Lionhead Studios Ltd/Black & White
This is the path you will give to openblack (using the -g or --game-path switch). The web build asks for this folder on its page.
If you prefer to copy the data (e.g. if you want to uninstall the original
game), just copy the Audio, Data and Scripts folders to the desired new location,
and give the path to this location to openblack (using the -g flag).
openblack is released as open source software under the GPL v3 license, see the license file in the project root for the full license text.