Progress thread for original version (2006)

A DOOM-style 3D engine for TI-83 and TI-83+ series calculators.

Moderator: benryves

User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

For the signed division/multiplication routines to work, it must first fix the sign of the operands so both are positive. The S24S16 division routine divides abc by de, and the negation of de used a.

With this, and a couple of other minor fixes, I get a lot closer:

Image

Still broken, though. :\
leofox
Calc Master
Posts: 1064
Joined: Fri 17 Dec, 2004 3:22 pm
Location: Probably playing DDR
Contact:

Post by leofox »

If you use collission detection it'd be okay right? Because it seems like it freaks out when you go THROUGH the wall, which you normally can't do in a game anyway.
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Sadly, it's not that easy (or that at all). It's worst when you're near a wall, as you noticed, but also goes wonky at odd moments when you can be quite a distance from the wall. :\
User avatar
Timendus
Calc King
Posts: 1729
Joined: Sun 23 Jan, 2005 12:37 am
Location: Netherlands
Contact:

Post by Timendus »

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
coelurus
Calc Wizard
Posts: 585
Joined: Sun 19 Dec, 2004 9:02 pm
Location: Sweden
Contact:

Post by coelurus »

I wouldn't say surprisingly fast, expectedly fast is better :wink:

Ben, you mentioned clipping to Y=0 "first", do you clip again?
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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:

Image

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)
coelurus
Calc Wizard
Posts: 585
Joined: Sun 19 Dec, 2004 9:02 pm
Location: Sweden
Contact:

Post by coelurus »

What would the Y=0-clip look like? I guess it would be cheaper than the origin-test (1 mul compared to 2 ?), since the line is to be clipped anyway.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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...

Image

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 Ãâ€â€
coelurus
Calc Wizard
Posts: 585
Joined: Sun 19 Dec, 2004 9:02 pm
Location: Sweden
Contact:

Post by coelurus »

Good stuff, one of the more "inspiring" threads around here lately :)
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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.
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

Image

Only problem now is when the camera is directly 'inside' a wall, but seeing as clipping (in the collision detection sense) would stop that it isn't much of a concern.
User avatar
tr1p1ea
Maxcoderz Staff
Posts: 4141
Joined: Thu 16 Dec, 2004 10:06 pm
Location: I cant seem to get out of this cryogenic chamber!
Contact:

Post by tr1p1ea »

Niiiiiiiice ben! I dont really see any problems at all. Will you be implementing some kind of line removal?
"My world is Black & White. But if I blink fast enough, I see it in Grayscale."
Image
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

With any luck, yes. I'll probably start with some ugly brute-force thing (just transform all the walls, sort from back-to-front then draw them all) but it should be enough to start with. Then it's more a case of working out the best way to sort things - possibly BSP tree?
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

I see you are trying your hands on Vista? :)

Will you use this for anything besides "for fun" (like a game)?
Image
User avatar
benryves
Maxcoderz Staff
Posts: 3087
Joined: Thu 16 Dec, 2004 10:06 pm
Location: Croydon, England
Contact:

Post by benryves »

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.
Post Reply