Learning to Raycast in Haskell

Posted on March 3, 2019 by Jack Kelly
Tags: haskell, coding

I built a raycaster in Haskell using codeworld-api over the weekend, and put the code up on sr.ht. Raycasting is not a particularly impressive technique these days: John Carmack did it 17 years ago in a cave! With a box of scraps! with texture mapping, while wrangling the IBM VGA, and while getting acceptable performance out of an 80386. (Aside: the Wolfenstein 3D Black Book is a fantastic read.)

Despite being obsolete, raycasting is a fun first step. I mostly followed F. Permadi’s tutorial from 1996, which does a pretty good job of deriving the maths, not just hitting you with walls of C. I was struggling to get the actual ray casting to work right, and eventually found the Algorithm of Amanatides and Woo. This post is about reaching that success, and reflecting on the thought processes that got me there.

Read more...
All Posts | RSS | Atom
Copyright © 2024 Jack Kelly
Site generated by Hakyll (source)