Skip to content

willbr/wolf.ai

Repository files navigation

Wolfenstein 3D SDL3 Port

A work-in-progress port of the original 1992 Wolfenstein 3D DOS source code to modern systems using SDL3 and the Zig build system.

Status

This port boots, loads shareware data, and displays the title screen and main menu.

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

Not Yet Implemented:

  • Gameplay (raycasting renderer, actors, shooting)
  • Audio (Adlib sound, digitized effects)
  • Save/load games
  • Mouse input

Quick Start

Prerequisites

  • Zig 0.16.0
  • Shareware Wolfenstein 3D v1.4 WL1 data files

Build

The first build compiles SDL3 from source (takes a few minutes). Subsequent builds are instant.

zig build

Run

zig build run

Or run the executable directly:

# Windows
zig-out\bin\wolf3d.exe

# macOS / Linux
zig-out/bin/wolf3d

Controls

Key Action
↑ / ↓ Navigate menu
Enter Select
Escape Back / Quit

Data Files

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.

Architecture

Build System

  • build.zig -- Zig build script
  • SDL3 built as a static library via CMake+Ninja from vendor/SDL3/
  • C sources compiled with zig cc

Source Layout

  • src/compat.h -- Borland C++ 3.0 to modern C compatibility layer
  • src/sdl3_main.c -- Entry point, SDL init, Borland register stubs
  • src/id_vl.c / src/id_vl.h -- SDL3 video backend
  • src/id_in.c -- SDL3 input backend (keyboard, timer)
  • src/id_ca.c -- Cache manager, Huffman/Carmack decompression
  • src/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 rendering
  • src/wl_main.c -- Main game loop, demo sequence
  • src/wl_menu.c -- Menu system
  • src/wl_def.h -- Core game types and definitions

Video

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.

Input

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().

License

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.

Acknowledgements

  • 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

References

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors