lindenbergresearch / rtdoom

Doom-style graphics engine in modern C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rtdoom

Implementation of a Doom-style graphics engine in C++ 17

Features

  • from-scratch software-based rendering implementation (no 3D libraries used)
  • following originally used algorithms: BSP tree, occlusion maps instead of z-buffer, no overdraw
  • ability to load original Doom WAD files

Screenshots

Wireframe mode

screenshot

Solid mode

screenshot

Textured mode

screenshot

Step frame mode

screenshot

Goal

While I follow original algorithms which were designed for resource-constrained architectures the primary goal of this project is to provide an easily understandable implementation and performance is not a focus (for example floating-point is used, objects are not reused as much as they could, many values are not precalculated etc.)

Algorithm

See Fabien Sanglard's Game Engine Black Book: DOOM for a walkthrough of algorithms used in the original game, most of which are replicated here.

Code

Test program uses SDL2 to render the raw framebuffer in a screen window, controls are:

  • arrow keys to move around
  • 1/2/3 to switch between render modes (Wireframe/Solid/Textured)
  • m to load the next map in the .wad file
  • s to slow down rendering of the next frame to see individual parts being drawn
  • Escape to exit

Built on Windows / Visual Studio 2017 using C++ 17 profile.

No assets included - you will need to drop off a .wad file from either the original Doom (1 or 2, shareware is ok) or the Freedoom project into the .exe directory!

Bonus - OpenGL Renderer

  • GLRenderer.cpp and GLContext.cpp contain a very basic hardware-accelerated renderer implemented using OpenGL 3.3 core profile, press 4 to switch the view to OpenGL. You will need to supply a V2 .gwa file alongside the .wad containing GL node data, which can be generated using glBSP.

screenshot

About

Doom-style graphics engine in modern C++

License:MIT License


Languages

Language:C++ 64.7%Language:C 35.3%