Building from source

Here we describe how to build ViZDoom from source. If you want to install pre-build ViZDoom wheels for Python, see Python quick start.

Dependencies

To build ViZDoom (regardless of the method), you need to install some dependencies in your system first.

Linux

To build ViZDoom on Linux, the following dependencies are required:

  • CMake 3.12+

  • Make

  • GCC 6.0+

  • Boost libraries 1.54.0+

  • Python 3.7+ for Python binding (optional)

Also some of additionally ZDoom dependencies are needed.

apt-based distros (Ubuntu, Debian, Linux Mint, etc.)

To get all dependencies on apt-based Linux (Ubuntu, Debian, Linux Mint, etc.) execute the following commands in the shell (might require root access).

# All possible ViZDoom dependencies,
# most are optional and required only to support alternative sound and music backends in the engine
# other can replace libraries that are included in the ViZDoom repository
apt install build-essential cmake git libsdl2-dev libboost-all-dev libopenal-dev \
zlib1g-dev libjpeg-dev tar libbz2-dev libgtk2.0-dev libfluidsynth-dev libgme-dev \
timidity libwildmidi-dev unzip

# Only essential ViZDoom dependencies
apt install build-essential cmake git libboost-all-dev libsdl2-dev libopenal-dev

# Python 3 dependencies (alternatively Anaconda 3 installed)
apt install python3-dev python3-pip
# or install Anaconda 3 and add it to PATH

dnf/yum-based distros (Fedora, RHEL, CentOS, Alma/Rocky Linux, etc.)

To get all dependencies on dnf/yum-based Linux (Fedora, RHEL, CentOS, Alma/Rocky Linux, etc.) execute the following commands in the shell (might require root access).

# Essential ZDoom dependencies
dnf install cmake git boost-devel SDL2-devel openal-soft-devel

# Python 3 dependencies (alternatively Anaconda 3 installed)
dnf install python3-devel python3-pip

Anaconda/Miniconda

If you do not have a root access, you can use a conda (e.g. miniconda) environment to install dependencies to your environment only:

conda install -c conda-forge boost cmake gtk2 sdl2

Note that to install ViZDoom in a conda environment you have to pull, build and install ViZDoom manually with

git clone https://github.com/mwydmuch/ViZDoom.git
cd ViZDoom
python setup.py build && python setup.py install

MacOS

To build ViZDoom on MacOS, the following dependencies are required:

  • CMake 3.12+

  • Clang 5.0+

  • Boost libraries 1.54.0+

  • Python 3.7+ for Python binding (optional)

Also some of additionally ZDoom dependencies are needed.

To get all the dependencies install homebrew first, than execute the following commands in the shell:

brew install cmake boost sdl2 openal-soft

⚠️ On Apple Silicon (M1, M2, M3 and M4), make sure you are using homebrew for arm64.

Here is a helpful command to set up the environment variables for homebrew on Apple Silicon if both arm64 and x86 versions were installed:

eval "$(/opt/homebrew/bin/brew shellenv)"

Windows

  • CMake 3.12+

  • Visual Studio 2012+

  • Boost libraries 1.54.0+

  • Python 3.7+ for Python binding (optional)

Additionally, ZDoom dependencies are needed. Most of them (except Boost) are gathered in this repository: ViZDoomWinDepBin. You can download Boost from here.

Building Python Type Stubs (vizdoom.pyi)

To enable Python typing support, the creation of a Python Interface file vizdoom.pyi is now part of the build process.

To ensure vizdoom.pyi is properly created, the following dependencies are required:

  • pybind11-stubgen

  • black (optional)

  • isort (optional)

They can all be installed via pip:

pip install pybind11-stubgen black isort

To test the generated stub manually:

stubtest vizdoom --allowlist stubtest_allowlists.txt

Building manylinux wheels

To build manylinux wheels you need to install docker and cibuildwheel. Then on Linux and MacOS run in ViZDoom root directory:

cibuildwheel --platform linux

The binary ViZDoom wheels will be placed in wheelhouse directory. In case of building using cibuildwheel, the dependencies are installed automatically inside the docker container, so you do not need to install them manually in your system.