ndoom
2021-04-08
Source: ndoom
An experiment in seeing how far a shell script can be pushed: a Wolfenstein-style raycaster written entirely in zsh, doing its trigonometry through bc -l and rendering the result as ASCII art in the terminal. One script casts rays across a small hardcoded map and writes each ray's hit distance out to a plain file. A second script reads that file back and draws a single ASCII frame from it, with closer walls shown as denser characters.
It's a one-frame renderer rather than an actual playable game. The loop that would tie the two scripts together into a live, moving view is written but deliberately left commented out. I was mostly curious whether shell arithmetic and bc could stand in for the floating-point trig a raycaster needs. Turns out yes, just very, very slowly.