Simple answer: It's the distance the ray must travel to reach the next horizontal grid line.
Why do we need it?
In raycasting, we want to find walls efficiently. Instead of checking every pixel, we jump from grid line to grid line!
Key variables:
pos_y = exact Y position of ray start (e.g., 125.7)map_y = which grid cell we're in (e.g., if pos_y=125.7 and BLOCK=50, then map_y=2)BLOCK = size of each grid cell (e.g., 50 pixels)delta_dist_y = how far ray travels to cross 1 grid unit verticallyAfter calculating side_dist_y, the DDA algorithm compares it with side_dist_x:
side_dist_y < side_dist_x → Ray hits horizontal wall firstside_dist_x < side_dist_y → Ray hits vertical wall firstThis is how games like Wolfenstein 3D determined which wall to render!