A Wolfenstein 3D–style raycaster engine written in ARM64 assembly, with a minimal C/SDL2 wrapper for cross-platform display.
This project implements a classic raycasting engine almost entirely in ARM64 assembly language. It renders a first-person 3D view from an 8×8 tile-based map, focusing on low-level control, determinism, and performance.
Features:
- Real-time raycasting with 64-angle rotation precision
- Distance-based lighting with three brightness zones
- Gradient sky and solid-color floor rendering
- Smooth WASD movement with wall collision detection
main.c - SDL2 window setup, input handling, render loop
raycaster.asm - ARM64 assembly raycasting engine
-
main.c initializes SDL2, allocates a framebuffer, and polls keyboard input.
-
raycaster.asm is invoked every frame and:
- Clears the screen (gradient sky + floor)
- Processes WASD input for movement and rotation
- Casts 640 rays (one per screen column)
- Uses precomputed sin/cos lookup tables
- Computes wall distances and projected heights
- Applies distance-based lighting and wall colors
- Writes pixels directly into the framebuffer (ARGB8888)
- macOS on Apple Silicon (ARM64)
- SDL2 (
brew install sdl2) - Xcode Command Line Tools
# Assemble the raycaster
as -o raycaster.o raycaster.asm
# Compile and link with SDL2
clang -o raycaster main.c raycaster.o \
-I/opt/homebrew/include \
-L/opt/homebrew/lib \
-lSDL2
# Run
./raycaster| Key | Action |
|---|---|
| W | Move forward |
| S | Move backward |
| A | Turn left |
| D | Turn right |
- Resolution: 640×480 @ 60 FPS (capped)
- Map Size: 8×8 tiles (32 pixels per tile)
- Color Format: ARGB8888
- Trig Tables: 64-entry sine and cosine tables (256 fixed-point scale)
- Ray Steps: Up to 64 steps per ray