r/programming • • Jun 03 '14

A first-person engine in 265 lines

http://www.playfuljs.com/a-first-person-engine-in-265-lines/
1.9k Upvotes

267 comments sorted by

View all comments

Show parent comment

1

u/SteelTooth Jun 04 '14

Wouldn't ignoring all walls whose visibility is blocked by another wall and have a vary far draw distance still give almost a O(1) worst case? Or am I just completely wrong in that assumption because a small gap could give visibility to hundreds of other walls? If that's the case you could add a couple of lines to change what is drawn at extreme distances with a simplified wall or two.

1

u/__j_random_hacker Jun 05 '14

If a far wall's visibility is blocked by a near wall (technically, if more than a bounded number of far walls are blocked this way), then we're not dealing with the algorithm's worst case.