Skip to content

balintkissdev/raycaster-engine

Repository files navigation

Raycaster engine

alt tag

Live demo | Windows 64-bit download | Linux 64-bit download

My take on making a raycasting pseudo-3D engine in C++, also with my own tiny template linear algebra types. One of the goals was to make raycasting computation equations more explicit and readable. Made first back in 2016 and adding code since to it.

alt tag

alt tag

Features

  • Up/Down to move and Left/Right to turn around
  • WASD to move and strafe
  • M to toggle mini-map
  • N to toggle "Night Mode" and display darkness and lighting effect

Requirements

  • C++17-standard compatible C++ compiler
  • CMake 3.16 or newer

That's all. The dependencies are automatically downloaded by Hunter.

Build

mkdir build
cd build
cmake ..
cmake --build . --config Release

For cross-compilation, you can use one of the CMake toolchain files.

TOOLCHAIN=cmake/toolchain/x86_64-w64-mingw32.cmake cmake ..

Emscripten support

This project can be built with Emscripten in order to be embedded in HTML. After you set up the Emscripten environment, issue these commands:

mkdir build
cd build
# Workarounds required for Emscripten and Hunter to work together on a local machine.
emcmake cmake \
  -DCMAKE_C_ABI_COMPILED=ON \
  -DCMAKE_CXX_ABI_COMPILED=ON \
  -DCMAKE_CROSSCOMPILING=ON \
  ..
emcmake cmake --build . --config Release

References: