v{x|y} = ray velocity for the {x|y} direction, calculated by a {sin|cos}*screen_width/2 + {cos|-sin}*screen_x (screen_x = 0 is in the centre of the screen)

g{x|y} = direction we’re going in for the {x|y} direction (-1 or 1)

av{x|y} = abs(v{x|y})

cs = cell size (personally I use 256 but if you’re using floats then 1.0 should do)

cx,cy = current cell we’re in

d{x|y} = distance to {x|y} wall

d(istance) = t(ime) * v(elocity) so t(ime) = d(istance) / v(elocity)

in this case we use av{x|y}, so

t{x|y} = d{x|y} / av{x|y}

t = total time elapsed

if tx == 0 or (ty != 0 and tx < ty) then we hit the x wall first, else we hit the y wall first.

We can compare that as dx*avy < dy*avx.

To avoid having to correct fisheye, for hitting the x wall we use tx instead of dx:

t += cs*tx (t += (cs*dx)/vx)

dy -= vy*tx (t += (vy*dx)/vx)

cx += gx

dx = cs

The column height is (screen_width*cs)/t.

Of course you probably knew all that. If I'm wrong about that, then feel free to use what you didn't know already

If you do the REALLY classic "3D maze" ( as in http://www.youtube.com/watch?v=VrmX-IJKPDo ), that would be hillarious.

]]>I think it’s a solid genre to work around, good luck! ]]>

That’s right, I’ve seen your site even before you were “The Minecraft guy”* I KNOW YOUR SECRETS

(*rather you were the “Infinite Mario Bros.” guy ðŸ˜‰ )

]]>