Show HN: Entombed in a Raycaster
2 days ago
- The Entombed algorithm is a maze generation method from the 1983 Atari 2600 game that procedurally creates mazes one row at a time using only 128 bytes of RAM.
- Each cell is determined by five neighboring cells (two to the left in the same row, three from the row above) via a 32-entry lookup table that outputs a wall, passage, or coin-flip, without backtracking or search.
- The algorithm's 'mystery table' remains not fully understood; it was reportedly sketched on napkins over beers by Paul Allen Newell and a maths grad student.
- Two correction passes are applied after each row to prevent repeated or walled-off sections, blanking the whole or half line.
- The author implemented the algorithm in a raycaster (like Wolfenstein 3D) using uint32 bits for rows, widened the playfield to 30 cells, kept all rows in memory, and added wall-breaking ability for players and enemies.
- A Three.js version playable in a browser was also created, with added effects and a Diablo-like minimap, to make the experience accessible without compiling C code.