News for hackers. Stuff that matters.
Re:Rustenstein 3D: Game programming like it's 1992 by a_e_k on Thursday February 03, 2022 @03:08AM (#30189934)
That's exactly what it's doing:

    let rayAngle = player.angle - player.fieldOfView / 2;
    for(let rayCount = 0; rayCount < screen.width; rayCount++) {

      // ... SNIP ...

      // the ray moves at constant increments
      let rayCos = Math.cos(degreeToRadians(rayAngle)) / precision;
      let raySin = Math.sin(degreeToRadians(rayAngle)) / precision;

      // ... SNIP ...

      // increment the angle for the next ray
      rayAngle += incrementAngle;
    }
It's also using Euclidean distance rather than planar distance for the apparent wall height calculation.

There are no comments on this comment yet.