Ready to execute
Hardware Heritage
Raycasting is the technique that powered Wolfenstein 3D (1992). It creates a 3D view from a 2D map by casting one ray for each vertical column of pixels on the screen.
386 Power
This was the first "fast" 3D algorithm for PCs. It relied on the fact that walls were always vertical and perpendicular, simplifying the math to simple trigonometry.
Texture Mapping
Wolf3D introduced texture mapping by scaling vertical strips of a wall texture based on the distance to the player.
Limitations
You couldn't look up or down, and all walls had to be the same height. Doom relaxed some of these limits but still used 2D sector logic.
Raycaster
The 2.5D engine that started the FPS genre.
Legacy C Code
// DDA Algorithm
while (hit == 0) {
if (sideDistX < sideDistY) {
sideDistX += deltaDistX;
mapX += stepX;
side = 0;
} else {
sideDistY += deltaDistY;
mapY += stepY;
side = 1;
}
if (worldMap[mapX][mapY] > 0) hit = 1;
}