Native Layer Overview - efroemling/ballistica GitHub Wiki

Ballistica consists of two layers; a low level 'native' layer written mostly in C++ and a high level layer written in Python. While the high level layer is generally more interesting for modding purposes, most of the low level layer source code is publicly available too for those so inclined to mess around with it.

Building From Source

While the easiest way to run Ballistica is to use the prefab Makefile targets, which use completely pre-built native layer binaries, it is also possible to compile most of the native layer from the source files contained in this repo.

First, a few caveats:

  • Some portions of the game/engine source remain closed; namely parts dealing with sensitive areas such as user accounts, network protocols, etc. The build pipelines here will automatically fetch precompiled libraries for these parts (you may notice names such as libballisticacore_internal.a) and the rest will be compiled locally. I will work to minimize the parts that need to be kept closed, and in the future I hope it will become possible to compile and run a 100% open-sourced version (perhaps with some functionality missing).
  • Building from source is only supported on a few platforms currently (see below for specifics). Hopefully this can expand over time. However note that any contributions made here will make their way back to all supported platforms (provided they apply to cross-platform portions of code).

Building with CMake

Builds for Unix type systems have been set up using the CMake build system. These should work on x86-64 Mac, arm64 Mac, x86-64 Linux, and arm64 Linux. Other platforms/architectures may partially compile but will fail due to the lack of a precompiled 'ballisticacore_internal' library.

  • First off, make sure you have completed the platform setup in Getting Started and are able to run prefab builds successfully.
  • Now, from the project root, simply run make cmake or make cmake-server to build and run the full game or the server.
  • Run make help and check out the 'CMake' section (or just look in the Makefile) to see what other related make targets are available.
  • The 'CMAKE_BUILD_TYPE' environment variable can be set to 'Debug' or 'Release' to influence the build type (Debug is default). So to compile and run a release-mode server, one could do: CMAKE_BUILD_TYPE=Release make cmake-server

Building with Visual Studio

Windows builds are set up using Microsoft Visual Studio. These should work on x86-64 machines running up-to-date builds of Windows 10.

  • First off, make sure you have completed the platform setup in Getting Started, including WSL installation, and are able to run prefab builds successfully.
  • You will need Visual Studio 2022 installed. Other versions may work but are not official supported. After installing Visual Studio, install these individual components
    • MSBuild
    • MSVC v143 - VS 2022 C++ x64/x86 build tools
    • Windows 10 SDK
    • Preferable Debugger(optional)
  • Now, from a WSL command line in the project root, run make windows-staging to prepare all the files necessary for the compilation process, including assets.
  • Run make windows-debug or make windows-release to build and run a debug or release version of the game.
  • Run make help and check out the 'Windows' section (or just look in the Makefile) to see what other related make targets are available.
  • The aforementioned Makefile commands will download/assemble resources and assets before compiling the game binaries. If you only want to (re)compile binaries, you can do so from within Visual Studio; simply open the project files under ballisticacore_windows.
  • It is technically possible to compile Windows binaries without having WSL installed if you are adventurous. The CI Action for this repo does just that. Take a look at the Windows portion of ci.yml to see how it works. Of course this just gives you the binary executable; you will need to manually copy all the asset/support files in from a working install of the game or some other source if you want it to run successfully. For this reason the WSL route is preferable; it will handle all of that for you.

<< Python Overview        Editor Setup >>