Building the project

Guide how to build Jazz² Resurrection.

The project requires following tools and libraries to build it successfully:

  • CMake 3.15 or newer
  • C++ compiler with C++17 support — any recent version of GCC, Clang and MSVC should work, MinGW and Clang-CL toolchains should be also supported
  • OpenGL 3.3, OpenGL|ES 3.0 or WebGL 2.0 library (alternatively ANGLE or Mesa translation library, not required with the software renderer or on the consoles that have a fixed-function rendering backend)
  • GLEW library (required only on Windows)
  • GLFW or SDL2 library (not required on Android, UWP and most consoles, because these platforms use a different backend)
  • libcurl library (not required on Emscripten and Windows, because these platforms use a different backend)
  • zlib library

In addition, these libraries are recommended for an optimal experience:

  • OpenAL library — audio support
  • libopenmpt library — module music playback
  • libogg / libvorbis library — .ogg file support (not needed for the original assets)
  • libwebp library — .webp file support (currently not supported, not needed for the original assets)
  • AngelScript library — AngelScript scripting support
  • liblua library — Lua scripting support (currently not supported)

It tries to download or compile all libraries automatically, but in case of build errors a manual download is necessary. Also, system-wide libraries have priority over the bundled ones, so in case of any incompatibility just install the system libraries.

How to get started

Clone the repository using any Git client, IDE, or command line:

git clone https://github.com/deathkiller/jazz2-native.git

To configure CMake, following commands can be used:

mkdir build
cmake -B build -D CMAKE_BUILD_TYPE=Debug -D NCINE_CREATE_CONTENT_SYMLINK=ON

Alternatively, change CMAKE_BUILD_TYPE to Release to enable all performance optimizations and disable debugging. You can also specify build configuration parameters, which are described below. In addition, you can use the NCINE_CREATE_CONTENT_SYMLINK parameter to automatically create a symbolic link to the "Content" directory in the target directory, otherwise you would have to copy it to "build" directory manually. To start actual build of the project, use following commands:

make -j $(nproc) -C build

Everything should be built into the "build" directory and ready to go.

Two offline tools are built alongside the game on desktop platforms and skipped when cross-compiling, because both of them run on the build machine: AssetPacker converts the original game data into the layout a given platform loads, and ShaderCompiler preprocesses the .shader files into the generated headers that are committed to the repository (so the game's own build never runs it).

Building on Android

Android build requires Android SDK and NDK installed, see Get started with the NDK. Assembling APK files also requires Gradle. Path to Gradle can be supplied by GRADLE_HOME environment variable if not detected automatically. The build can be configured using a similar command as above:

mkdir build
cmake -B build -D CMAKE_BUILD_TYPE=Debug \
    -D NCINE_BUILD_ANDROID=ON \
    -D NCINE_UNIVERSAL_APK=ON \
    -D NCINE_NDK_ARCHITECTURES="arm64-v8a;armeabi-v7a"

See Platform-specific parameters for Android for more details. Then following commands can be used to build the project and assemble the APK file:

make -j $(nproc) -C build
cd build
gradle assembleDebug

Alternatively, replace assembleDebug with assembleRelease to create release APK file.

Building on Windows

On Windows, Visual Studio can be used. Using already included .sln is not recommended, because it requires manual configuration and doesn't support all features and parameters. Instead the project can be opened as CMake directory directly in Visual Studio, or it can be configured using a similar command as above:

mkdir build
cmake -B build -D CMAKE_BUILD_TYPE=Debug -A x64 ^
    -D CMAKE_SYSTEM_PROCESSOR=x64 ^
    -D NCINE_CREATE_CONTENT_SYMLINK=ON

See Platform-specific parameters for Windows for more details. To build it for 32-bit operating system, use Win32 instead of x64. To change version of VS toolset, use -D CMAKE_GENERATOR_TOOLSET=… parameter. By default CMake creates a new Visual Studio .sln solution and project files in "build" directory that can be opened easily afterwards. Building with Clang-CL compiler is also possible specifying -T ClangCL parameter.

Building for Xbox (Universal Windows Platform)

The same commands can be used as for Windows, but two additional parameters must be specified to change the target:

cmake -B build -D CMAKE_BUILD_TYPE=Debug -A x64 ^
    -D CMAKE_SYSTEM_PROCESSOR=x64 ^
    -D CMAKE_SYSTEM_NAME=WindowsStore ^
    -D CMAKE_SYSTEM_VERSION="10.0"

Additionaly, a code-signing certificate is required to create an installable .msixbundle package. See Platform-specific parameters for Universal Windows Platform for more details.

Building for consoles

Six consoles are supported, each cross-compiled with its own SDK and its own CMake toolchain file. The build is configured the same way as above — "Build<Platform>.sh" scripts in the repository root wrap it — but every one of them also needs its toolchain installed, its own packaging step and, on four of them, a game content tree prepared in advance with AssetPacker. All of that is documented in depth on a page of its own:

ConsoleToolchainBuild scriptDetails
Sega DreamcastKallistiOS"BuildDreamcast.sh"Sega Dreamcast
PlayStation Portablepspdev"BuildPsp.sh"PlayStation Portable
Nintendo WiidevkitPPC + libogc"BuildWii.sh"Nintendo Wii
Nintendo GameCubedevkitPPC + libogc"BuildGameCube.sh"Nintendo GameCube
PS VitaVitaSDK"BuildVita.sh"PS Vita
Nintendo SwitchdevkitA64Nintendo Switch

See Building for consoles for the toolchain installation, deployment to the device or an emulator, how to read the game's log on each of them, and what each console does and does not support. The game can also be built as a libretro core for RetroArch, see Libretro core.


Build configuration parameters

By default it tries to find the first available backend for the currently installed libraries. GLFW is usually preferred over SDL2, because it's more lightweight. On the other hand, SDL2 usually has better gamepad support and better support in general. The following parameters can be used to customize the build:

  • CMAKE_BUILD_TYPE — Build configuration
    • Possible values: Debug, Release
  • CMAKE_INSTALL_PREFIX (default "/usr/local") — Install prefix on Unix systems
  • NCINE_CONTENT_DIR (default "./Content") — Path to the "Content" game data directory
    • Some build targets include "Content" directory directly inside the executable package (e.g., Android)
  • NCINE_CREATE_CONTENT_SYMLINK (default OFF) — Create symbolic link to the "Content" game data directory in target directory
    • Ignored on Android, Emscripten, Nintendo Switch and UWP platforms
  • NCINE_DOWNLOAD_DEPENDENCIES (default ON) — Download all missing dependencies automatically
  • NCINE_BUILD_ASSET_PACKER (default ON) — Build the offline AssetPacker tool
    • It runs on the build machine, so it's skipped for every cross-compiled target
  • NCINE_BUILD_LIBRETRO (default OFF) — Build as a libretro core instead of an executable, see Libretro core
    • Only Software and OpenGL are valid values of NCINE_PREFERRED_RHI in this configuration
  • NCINE_PREFERRED_BACKEND (default "GLFW", "SDL2" on PS Vita and Nintendo Switch) — Preferred core backend
  • NCINE_PREFERRED_RHI (default "OpenGL") — Preferred rendering backend (RHI)
    • Possible values:
      • OpenGL — Uses the OpenGL family (which profile is chosen with NCINE_RHI_GL_PROFILE)
      • D3D11 — Uses Direct3D 11 (Windows only)
      • Vulkan — Uses Vulkan
      • Software — Uses custom software renderer (no hardware acceleration, lower visual quality and performance)
    • Pinned to the console's only rendering backend on Sega Dreamcast (PVR), Nintendo Wii and Nintendo GameCube (GX) and PlayStation Portable (GU); any other value is a configure error there, see Building for consoles
  • NCINE_RHI_GL_PROFILE — Which profile of the OpenGL family the OpenGL backend targets
    • Possible values:
      • Core — OpenGL 3.3 core profile (GLSL 330, uniform buffer objects, gl_VertexID)
      • ES3OpenGL|ES 3.0, and WebGL 2.0 on Emscripten (ESSL 300 es)
      • ES2OpenGL|ES 2.0 (ESSL 100, no uniform buffer objects, no gl_VertexID, no buffer mapping)
    • Defaults to ES3 on Android, Emscripten, Nintendo Switch, ARM Linux and ANGLE builds, and to Core elsewhere; pinned to ES2 on PS Vita (vitaGL is an OpenGL|ES 2.0 implementation) and to ES3 for the libretro core
    • Every profile builds on every platform that can provide the matching client library, so an ES2 build on Android or on the desktop is a normal configuration — it is how the low-end paths are tested without the target hardware
  • NCINE_RHI_USE_FB16 (default OFF) — Use 16-bit (RGB565) color surfaces instead of RGBA8
    • Trades color depth (and destination alpha, which reads as opaque) for memory and bandwidth. Being a performance option, each backend applies it as deep as it pays off there: the OpenGL backend uses it for every color surface it can — a 5/6/5 default framebuffer and RGB565 scene, blur and rescale render targets — while the Software backend uses it for the screen buffer only, since its rasterizer works on RGBA8 internally either way and packed render targets would only add a conversion per span
    • Only offered for the Software and OpenGL backends; the consoles present through a format their hardware fixes, and 5/6/5 swap chains are not reliably available on D3D11/Vulkan
  • NCINE_VERSION_FROM_GIT (default ON) — Set current game version from Git repository automatically
  • NCINE_WITH_THREADS (default ON except on Emscripten and PlayStation Portable) — Allow to use multiple threads for better performance
    • Multiplayer requires threads, so it's compiled out where they are unavailable
  • NCINE_WITH_ANGLE (default OFF except on UWP) — Enable Google ANGLE library support
  • NCINE_WITH_GLEW (default ON) — Use GLEW library, only offered for NCINE_RHI_GL_PROFILE=Core
  • NCINE_WITH_BACKWARD (default ON except on Android, Emscripten and UWP) — Enable better exception handling
  • NCINE_WITH_WEBP deprecated — Enable .webp image file support, requires libwebp library
  • NCINE_WITH_AUDIO (default ON) — Enable audio support, requires OpenAL library
  • NCINE_WITH_VORBIS (default ON) — Enable .ogg audio file support, requires libvorbis library
  • NCINE_WITH_OPENMPT (default ON, forced OFF on PlayStation Portable) — Enable module music audio file support, requires libopenmpt library
    • NCINE_COMPILE_OPENMPT (default OFF) — Download and compile libopenmpt library from source automatically
    • See Limits and known issues for why it's disabled on PlayStation Portable
  • NCINE_WITH_ANGELSCRIPT (default OFF) — Enable AngelScript scripting support
    • ANGELSCRIPT_VERSION_TAG allows to specify the version to be downloaded if NCINE_DOWNLOAD_DEPENDENCIES is enabled
  • NCINE_WITH_LUA deprecated — Enable Lua scripting support
  • NCINE_WITH_IMGUI (default OFF) — Enable integration with Dear ImGui library
    • IMGUI_VERSION_TAG allows to specify the version to be downloaded

Platform-specific parameters for Android

  • NCINE_BUILD_ANDROID (default OFF) — Enable building for Android platform
  • NCINE_ASSEMBLE_APK (default ON) — Assemble Android APK file, requires with Gradle
  • NCINE_NDK_ARCHITECTURES (default "arm64-v8a") — Semicolon-separated list of target CPU architectures
    • Possible values: arm64-v8a (for 64-bit ARM), armeabi-v7a (for 32-bit ARM), x86, x86_64
  • NCINE_UNIVERSAL_APK (default OFF) — Create universal APK containing all specified CPU architectures
  • NDK_DIR — Android NDK directory, usually detected automatically

Platform-specific parameters for Linux

  • NCINE_ASSEMBLE_DEB (default OFF) — Assemble DEB package of the game
  • NCINE_ASSEMBLE_RPM (default OFF) — Assemble RPM package of the game
  • NCINE_BUILD_FLATPAK (default OFF) — Build Flatpak version of the game
  • NCINE_LINUX_PACKAGE — Override Linux package name, otherwise "Jazz² Resurrection" will be used
  • NCINE_OVERRIDE_CONTENT_PATH — Override "Content" directory path
    • If not specified, following path will be used: CMAKE_INSTALL_PREFIX "/share/" NCINE_LINUX_PACKAGE "/Content/"
  • NCINE_PACKAGED_CONTENT_PATH (default OFF) — Use alternative path search strategy
    • If enabled, "Content" will be always relative to current directory
    • Has higher priority than NCINE_OVERRIDE_CONTENT_PATH

Platform-specific parameters for Windows

  • DEATH_WITH_VC_LTL (default ON) — Build with VC-LTL for lighter binaries, requires VC-LTL
  • NCINE_COPY_DEPENDENCIES (default ON) — Copy all required libraries to build target directory automatically
  • NCINE_INSTALL_SYSLIBS (default OFF) — Install the required MSVC system libraries with CMake

Platform-specific parameters for Universal Windows Platform

  • NCINE_UWP_CERTIFICATE_THUMBPRINT — Code-signing certificate thumbprint
    • Use either NCINE_UWP_CERTIFICATE_THUMBPRINT or NCINE_UWP_CERTIFICATE_PATH
  • NCINE_UWP_CERTIFICATE_PATH (default "UwpCertificate.pfx") — Code-signing certificate path
  • NCINE_UWP_CERTIFICATE_PASSWORD (optional) — Code-signing certificate password for NCINE_UWP_CERTIFICATE_PATH

Advanced parameters

  • DEATH_CPU_USE_RUNTIME_DISPATCH — Build with runtime dispatch for CPU-dependent functionality
    • Uses code paths optimized for multiple architectures with the best-matching variant selected at runtime based on detected CPU features, see Death::Cpu namespace
    • Enabled by default if DEATH_CPU_USE_IFUNC is supported
  • DEATH_CPU_USE_IFUNC (default ON if supported) — Allow using GNU IFUNC for runtime CPU dispatch
  • DEATH_DEBUG — Enable verbose logging and additional assertions for debugging
    • Enabled by default for Debug build configuration
  • DEATH_DEBUG_SYMBOLS — Create debug symbols for executable
    • A separate .pdb file will be created on Windows and Linux, on other platforms the symbols will probably be embedded in the executable
    • Enabled by default on Windows platforms
  • DEATH_TRACE (default ON) — Enable runtime event tracing, see Asserts.h file
  • DEATH_TRACE_ASYNC (default ON if NCINE_WITH_THREADS) — Enable asynchronous processing of event tracing for better performance
    • Always OFF on the consoles and in the libretro core
  • DEATH_TRACE_LOG_PATH — Override path to trace log file if specified
    • Also forces writing traces to file on some platforms (except on Android/Switch where it's already forced)
  • DEATH_USE_RUNTIME_CAST (default ON) — Enable Death::runtime_cast() and type information optimization
  • NCINE_ADDRESS_SANITIZER (default OFF) — Enable AddressSanitizer memory error detector
  • NCINE_ARCH_EXTENSIONS — Target CPU architecture extensions (instruction sets)
    • Depends on target CPU and compiler support
    • See documentation of /arch in MSVC (docs) and -m in GCC (docs) for more details
  • NCINE_CODE_COVERAGE (default OFF) — Enable gcov instrumentation for testing code coverage
  • NCINE_GCC_HARDENING (default OFF) — Enable memory corruption mitigation methods of GCC
  • NCINE_LINKTIME_OPTIMIZATION (default ON) — Compile with link-time optimization
  • NCINE_THREAD_SANITIZER (default OFF) — Enable ThreadSanitizer detector
  • NCINE_UNDEFINED_SANITIZER (default OFF) — Enable UndefinedBehaviorSanitizer detector

Debugging parameters

  • NCINE_AUTOVECTORIZATION_REPORT (default OFF) — Enable report generation from compiler auto-vectorization
  • NCINE_INPUT_DEBUGGING (default OFF) — Enable extensive (gamepad) input debugging and logging
  • NCINE_PROFILING (default OFF) — Enable profiling
  • NCINE_STRIP_BINARIES (default OFF) — Strip debug symbols from binaries for smaller size
  • NCINE_WITH_FIXED_BATCH_SIZE (default OFF) — Enable fixed batch size for rendering
  • NCINE_WITH_RENDERDOC deprecated — Enable integration with RenderDoc
  • NCINE_WITH_TRACY (default OFF) — Enable integration with Tracy frame profiler
    • TRACY_VERSION_TAG allows to specify the version to be downloaded

Game-specific parameters

  • DISABLE_RESCALE_SHADERS (default OFF) — Disable rescale shaders and use only nearest neighbor
    • Rescale shaders are not available with software renderer
  • TILEMAP_USE_SINGLE_DRAW (default ON) — Aggregate draw calls for each tilemap layer
  • SHAREWARE_DEMO_ONLY (default OFF) — Shareware Demo only, usually used on Emscripten platform
  • WITH_MULTIPLAYER (default ON) — Enable multiplayer support
  • WITH_ONLINE_MULTIPLAYER (default ON if WITH_MULTIPLAYER) — Enable also online multiplayer support, otherwise only local splitscreen is enabled
  • WITH_WEBSOCKET (default ON) — Enable WebSocket transport for online multiplayer
  • WITH_WEBSOCKET_TLS_BACKEND (default OpenSSL) — TLS backend for WebSocket transport
    • Possible values: OpenSSL, mbedTLS, None
  • DEDICATED_SERVER (default OFF) — Build the application as dedicated server only, WITH_MULTIPLAYER must be enabled
  • SHAREWARE_DEMO_ALLOW_MULTIPLAYER (default ON if SHAREWARE_DEMO_ONLY) — Enable multiplayer support also in Shareware Demo