Progress thread for original version (2006)
Posted: Mon 03 Apr, 2006 10:43 am
Well, I gave raycasting a shot (and got nowhere with it!) and as Timendus is working on a raycaster himself I thought I'd go back to a vertex-based engine.
I already had some basic 8-bit 2D rotations going, so upped that to 16-bit and optimised them quite a bit:
Having worked with DOOM recently, I think it's best to isolate the various parts of the world - the world's vertices are transformed in a batch. I'll then have a list of walls, linking vertices (by index).
Backface culling is trivial in this setup (if the second vertex's x is smaller than the first vertex's, it's invisible), the big problem I'm hitting upon is clipping the line to the view.
I'll use a triangle, where the valid points are in x<y && x>-y && y>0. Hopefully this would ease calculations.
I can't think of a sensible way to clip the line, though. Would a linear interpolation job be sensible? I'm trying to steer well away from any extra division/multiplication though... I'm already at 4 signed 16-bit multiplications per vertex. Then again, walking along the line using Bresenham until you hit a valid point sounds like an evil hack
I already had some basic 8-bit 2D rotations going, so upped that to 16-bit and optimised them quite a bit:
Having worked with DOOM recently, I think it's best to isolate the various parts of the world - the world's vertices are transformed in a batch. I'll then have a list of walls, linking vertices (by index).
Backface culling is trivial in this setup (if the second vertex's x is smaller than the first vertex's, it's invisible), the big problem I'm hitting upon is clipping the line to the view.
I'll use a triangle, where the valid points are in x<y && x>-y && y>0. Hopefully this would ease calculations.
I can't think of a sensible way to clip the line, though. Would a linear interpolation job be sensible? I'm trying to steer well away from any extra division/multiplication though... I'm already at 4 signed 16-bit multiplications per vertex. Then again, walking along the line using Bresenham until you hit a valid point sounds like an evil hack