Progress thread for original version (2006)
Moderator: benryves
Nevertheless, it looks good and it's surprisingly fast imho.
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Actually, the currently rewritten code doesn't bother clipping to Y=0 first, which might be part of the bugginess.
There is a reason to clip to Y=0 first - consider the following:
When performing the clipping, I need to know which boundary - y=+x or y=-x - I need to clip to.
The easiest check is whether the X coordinate of the out-of-bounds point is > 0 or < 0. As you can see with the red and blue lines, this works fine. If you look at the green line, however, the X < 0 but you'd want to clip it as if it was > 0. Therefore, it is neccessary to clip it to Y=0 first, then check the X coordinate and clip to y=+x or y=-x as normal, based on that decision.
(Just thought of one quick optimisation - this extra clip-to-y step is only required if the sign of end[0].x != the sign of end[1].x)
There is a reason to clip to Y=0 first - consider the following:
When performing the clipping, I need to know which boundary - y=+x or y=-x - I need to clip to.
The easiest check is whether the X coordinate of the out-of-bounds point is > 0 or < 0. As you can see with the red and blue lines, this works fine. If you look at the green line, however, the X < 0 but you'd want to clip it as if it was > 0. Therefore, it is neccessary to clip it to Y=0 first, then check the X coordinate and clip to y=+x or y=-x as normal, based on that decision.
(Just thought of one quick optimisation - this extra clip-to-y step is only required if the sign of end[0].x != the sign of end[1].x)
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Have another screenshot - I stuck the 'check for Y < 0' code back in, tidied up a few things and optimised a few silly repeated calculations...
Note that when I walk through a wall now, rather than have a few frames of dancing junk lines, you (fairly) smoothly 'snap' through to the other side.
Here are the formulae I currently use.
I derived them by lots of scribbling and fudging the equation of a line 'y = mx + c'. They're as simple as I can make them.
m is held as signed 8.8 fixed-point value. c is held as a signed 16.8 fixed-point value.
The following hold for when the difference in X is greater than the difference in Y.
m = (Y1 - Y0) ÷ (X0 - X1) ; m is negative gradient.
c = Y0 + m Ãâ€â€
Note that when I walk through a wall now, rather than have a few frames of dancing junk lines, you (fairly) smoothly 'snap' through to the other side.
Here are the formulae I currently use.
I derived them by lots of scribbling and fudging the equation of a line 'y = mx + c'. They're as simple as I can make them.
m is held as signed 8.8 fixed-point value. c is held as a signed 16.8 fixed-point value.
The following hold for when the difference in X is greater than the difference in Y.
m = (Y1 - Y0) ÷ (X0 - X1) ; m is negative gradient.
c = Y0 + m Ãâ€â€
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Thanks. Did you ever get much done with converting your variable-height raycaster to Z80 assembly?
Something I didn't mention - in the screenshot above, sometimes there are two little dots in the left/right most column. This seems to be a bug where completely off-screen walls are clipped but both to the left or right side, rather than being discarded completely.
Something I didn't mention - in the screenshot above, sometimes there are two little dots in the left/right most column. This seems to be a bug where completely off-screen walls are clipped but both to the left or right side, rather than being discarded completely.
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
Not quite, XP Visual Style
As for a game, it depends whether I can get it to be fast enough to be game-worthy. If so, a DOOM-esque shooter would be the obvious step to take.
As for a game, it depends whether I can get it to be fast enough to be game-worthy. If so, a DOOM-esque shooter would be the obvious step to take.