← Back to ratslair.com
aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: d55cab76ec6515f6fa2b241dd7073c6c94b326c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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.

`ndoom.sh` casts 91 rays across a fixed 8x8 hardcoded map, walking each one out step by step and writing its hit distance to a plain file called `distances`. `render.sh` reads that file back and draws one ASCII frame from it — closer walls as `#`, a floor tint below a `height` line, and blank sky above it. It's a single-frame renderer rather than a live game: the loop that would tie the two scripts together into an actual playable frame-by-frame walk is written but commented out in `ndoom.sh`, so right now it's run as two separate steps by hand.

Mostly just curious to see whether shell arithmetic and `bc` could stand in for the floating-point trig a raycaster needs — turns out yes, just very, very slowly.

## Running

```sh
./ndoom.sh      # casts rays, writes ./distances
./render.sh     # reads ./distances, draws one ASCII frame
```

Needs `zsh` and `bc`.