79652941

Date: 2025-06-04 14:14:50
Score: 1
Natty:
Report link

So I discovered the main culpret and really it was quite simple, but was somthing that I completley overlooked. As was sugguested the problem did in face lie in the player height. While half the screen height is a way to represent the player height, that would be in screen space. FlatLnDist needed the player height in world space which is TILE_SIZE / 2. So now I've added the player's world space height to the player struct and the formula now looks like this: flatLnDist = (player.height * DIST_PROJ_PLANE) / r; I also added ceiling rendering like so: ceilingY = (GAMEWINDOW_HEIGHT / 2) - r; Because each vertical scanline, both in the floor and ceiling have the same pixel x cordinate and all the rest of the math for the ceiling is already done by the floor, I only have to modify the pixel y cordinate to esenitally mirror the floor projection over the horizon line. The result is so:[!Successful floor and ceiling projectionenter image description here](https://i.sstatic.net/3GYH8vnl.png)

Excellent. The only issue now I belive has to do with rounding and how the walls scale the closer and further away from them you are. In anycase I feel I've sufficently answered my original question and if I do get stumped on this new issue it seems it would be better to just create a new post.

Reasons:
  • Blacklisted phrase (1): enter image description here
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Levi