A work-in-progress port of the original 1992 Wolfenstein 3D DOS source code to modern systems using SDL3 and the Zig build system.
This port boots, loads shareware data, runs the title sequence and menus, and renders gameplay with the original tile-DDA raycaster.
Implemented:
- SDL3 window (640x400 with 2x integer scaling)
- 320x200 planar Mode Y screen buffer emulation in software
- SDL3 keyboard input (arrow keys, Enter, Escape)
- Palette-based rendering with fade in/out effects
- Title screen, credits, high scores, main menu
- Font rendering (proportional and color)
- Shareware data loading (VGA, maps, audio headers)
- Huffman and Carmack decompression
- Planar-to-linear framebuffer conversion
- Tile-DDA raycaster: textured walls, doors, pushwalls
- Ceiling/floor solid-color fill
- Scaled actor and static sprites, masked against the wall z-buffer
- Player weapon sprite (held + firing frames)
- Status bar with face, ammo, score, keys, weapon icons
Not Yet Implemented:
- Audio (Adlib sound, digitized effects)
- Save/load games
- Mouse input
- Floor/ceiling texture mapping (wolfhack mode)
- Pain frames for two-rotation enemies (cosmetic)
- Zig 0.16.0
- Shareware Wolfenstein 3D v1.4 WL1 data files
The first build compiles SDL3 from source (takes a few minutes). Subsequent builds are instant.
zig buildzig build runOr run the executable directly:
# Windows
zig-out\bin\wolf3d.exe
# macOS / Linux
zig-out/bin/wolf3d| Key | Action |
|---|---|
| ↑ / ↓ | Navigate menu |
| Enter | Select |
| Escape | Back / Quit |
Place the shareware Wolfenstein 3D v1.4 WL1 files in wolf3d-data/:
wolf3d-data/
AUDIOHED.WL1
AUDIOT.WL1
VGADICT.WL1
VGAHEAD.WL1
VGAGRAPH.WL1
MAPHEAD.WL1
MAPTEMP.WL1
VSWAP.WL1
You can get the shareware data from the Internet Archive or Wolfenstein 3D Dome.
build.zig-- Zig build script- SDL3 built as a static library via CMake+Ninja from
vendor/SDL3/ - C sources compiled with
zig cc
src/compat.h-- Borland C++ 3.0 to modern C compatibility layersrc/sdl3_main.c-- Entry point, SDL init, Borland register stubssrc/id_vl.c/src/id_vl.h-- SDL3 video backendsrc/id_in.c-- SDL3 input backend (keyboard, timer)src/id_ca.c-- Cache manager, Huffman/Carmack decompressionsrc/id_mm.c-- Memory manager (flat malloc wrappers)src/id_pm.c-- Page manager (VSWAP file loader)src/id_vh.c/src/id_vh.h-- High-level drawing, font renderingsrc/wl_main.c-- Main game loop, demo sequencesrc/wl_menu.c-- Menu systemsrc/wl_def.h-- Core game types and definitions
The game renders to a 320x200 planar Mode Y buffer (screenbuffer[4][48000]),
matching the original VGA hardware layout. Each frame is converted to a linear
32-bit RGB buffer and presented via SDL3 streaming texture.
SDL3 keyboard events are mapped to DOS scancodes. The global Keyboard[] array
is updated on key press/release, matching the original interrupt-driven input model.
TimeCount increments at ~70Hz using SDL_GetTicks().
The original Wolfenstein 3D source code was released by id Software under the
GNU GPL v2. See COPYING for details.
This port is also released under the GNU GPL v2.
SDL3 is licensed under the zlib license.
- id Software for releasing the original source
- Wolfenstein 3D Dome for shareware data and community
- SDL for the cross-platform media library
- Zig for the build system and toolchain
- This port was built entirely by OpenCode Go using the Kimi K2.6 AI agent
- Raycaster, sprite blitter, HUD icons, and frame-presentation glue contributed by Claude Opus 4.7 via Claude Code
- Original source:
wolf3d-master/WOLFSRC/(preserved, unmodified) - Ported source:
src/(active development) - Wolfenstein 3D Bible (archive.org mirror)
- Fabien Sanglard's Wolfenstein 3D Black Book
- SDL3 Documentation