The player has a field of view. It is how much they can see to the left and right. Normally this is 60° or 90°. The algorithm works on columns. You scan from the players location and angle minus half the field of view to the players angle and location plus half the field of view. For each column you figure out how far a ray would go from the player's location along the calculated angle for the col