Skip to content

A Wolfenstein 3D-style raycaster engine written in ARM64 assembly, with a minimal C/SDL2 wrapper for cross-platform display.The engine renders a first-person 3D perspective view of an 8x8 tile-based map,

License

Notifications You must be signed in to change notification settings

loveucifer/AssemblyRaycaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assembly Raycaster

A Wolfenstein 3D–style raycaster engine written in ARM64 assembly, with a minimal C/SDL2 wrapper for cross-platform display.

Assembly Raycaster Screenshot

Overview

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

Architecture

main.c          - SDL2 window setup, input handling, render loop
raycaster.asm   - ARM64 assembly raycasting engine

How It Works

  1. main.c initializes SDL2, allocates a framebuffer, and polls keyboard input.

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

Building

Requirements

  • macOS on Apple Silicon (ARM64)
  • SDL2 (brew install sdl2)
  • Xcode Command Line Tools

Compile and Run

# 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

Controls

Key Action
W Move forward
S Move backward
A Turn left
D Turn right

Technical Details

  • 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

About

A Wolfenstein 3D-style raycaster engine written in ARM64 assembly, with a minimal C/SDL2 wrapper for cross-platform display.The engine renders a first-person 3D perspective view of an 8x8 tile-based map,

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published