CAST.TXT	12-Jan-2006

This is an example of a simple raycaster. Raycasting is similar to
raytracing, but it speeds things up by using streamlined calculations in
the vertical direction.

Use the mouse to move through the rooms. There aren't any demons to
shoot, but you might find a bug or two. Hit any key to quit.

This boils the essentials down to six pages of code.

The drawing in CAST.BMP shows how the calculations are done. The green
area is what gets displayed when the viewer is standing at Vx,Vy and
facing direction Vd. An example ray is shown along with the calculations
that are used to determine Wx, which is the point where the ray
intersects the wall. This determines the vertical slice of a wall-panel
image that is to be displayed. The height of the slice is inversely
proportional to the distance Dh. Pixels along the slice are sampled at
evenly spaced intervals to generate the required height. This sampling
can be done very quickly, and it's what distinguishes raycasting from
raytracing.

There are many books on raycasting. The best one I've found is "Amazing
3-D Games Adventure Set" by Lary L. Myers. Most of wall images in my
example are from the book. (Thanks Lary!)

-Loren
