Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: squidgetx on December 03, 2010, 07:16:28 am

Title: Axe Raycaster
Post by: squidgetx on December 03, 2010, 07:16:28 am
*ahem* introducing a little side project I've been working on: a raycasting engine in Axe :D
Runs faster on 15Mhz models (maybe a little too fast) and a bit slower on 6mhz models (almost too slow  :P)
It's very basic right now, and supports single color walls (no textures or sprites), but it does have collision testing and all the basic features of a raycasting engine :D (rotation, moving, etc.) and can be used to make a (sort of) enterntaining maze game ;) It only uses the first 80 columns of the screen (for speed, and because I'm too lazy to change it. Also I'm sure this area could be used when making a real game for a user display or something)

(http://img.removedfromgame.com/imgs/axeraycaster.gif)

use left/right to turn, up/down to go forward/backwards respectively. You can press Mode to view the map, and 2nd to quit the map. Press clear to exit the game.

Maps are currently 96x64, and the program will take the picture from OS Pic3 to be the map.

Source is in....RAYSRC, executable is in RAY (nostub) A sample map is included

Currently sits at under 1000 bytes ;D

Things I might add sometime are textures (or at least another color of wall), scaled sprites (not too sure how that will work), and fixing any bugs you guys find. The only bug I've found so far is that everything looks kind of distorted if you get too close to it :P
Title: Re: Axe Raycaster
Post by: Happybobjr on December 03, 2010, 07:45:11 am
cool good job.

downloading to wabbit at my school.
Title: Re: Axe Raycaster
Post by: SirCmpwn on December 03, 2010, 08:41:10 am
Very nice!
Title: Re: Axe Raycaster
Post by: Yeong on December 03, 2010, 10:12:59 am
starts with nspire raycaster, and now the axe one...
*Yeong assumes that there will be FPS games for Axe later
Title: Re: Axe Raycaster
Post by: aeTIos on December 03, 2010, 10:16:50 am
starts with nspire raycaster, and now the axe one...
*Yeong assumes that there will be FPS games for Axe later
Of course they will be here!
Title: Re: Axe Raycaster
Post by: Yeong on December 03, 2010, 10:19:29 am
CoD games....? O_o
Title: Re: Axe Raycaster
Post by: squidgetx on December 03, 2010, 06:06:05 pm
Actually worked on this quite a bit today: I've added shading according to distance and lengthened your line of sight. I've also located the bug that may cause some of the distortion but I haven't managed to fix it yet :P
Title: Re: Axe Raycaster
Post by: Runer112 on December 03, 2010, 06:08:04 pm
A while ago I was toying with the idea of a raycaster in Axe, but I couldn't get the math right. Looking at your source code now, it makes so much sense.

I figured the least I could do to help was to give it a bit more kick ;) I could hardly avoid from crashing into walls it was so fast.
Title: Re: Axe Raycaster
Post by: squidgetx on December 03, 2010, 06:09:40 pm
holy...... :o how did you do that?
Title: Re: Axe Raycaster
Post by: ztrumpet on December 03, 2010, 06:10:40 pm
That looks awesome!  Nice job squidgetx! ;D

Edit: Wow, Runer, that's quick! O0
Title: Re: Axe Raycaster
Post by: Munchor on December 03, 2010, 06:19:55 pm
Hum... Axe Doom????

Very good job! Now, i have a doubt, is the map repeating a few times?
Title: Re: Axe Raycaster
Post by: Runer112 on December 03, 2010, 06:25:36 pm
Well that's at 15MHz, so it runs really fast. But I did some rough testing and my modification makes it run about twice as fast at either 6MHz or 15MHz.

I figured that the slowest part of the engine was probably drawing the lines, so I decided to work on that. I did cheat a bit, though, because the speed boost was from a hand-written assembly routine. It took me a few hours, but I managed to make a special case vertical line drawing routine. For drawing vertical lines, it's on average probably 5-10x faster than the normal line drawing routine. I might submit it to Quigibo so he can add it as a built-in feature, although I don't know if it has enough circumstances in which it would be useful to warrant its addition into the standard command set. But then using it wouldn't be cheating any more. ;)

Anyways, I don't think Axioms are working right now so I had to sort of hack together a method to use it as a fake Axiom.
Code: [Select]
.X coordinate
Z-{L1}+40Asm(E5)
32/E→H
.Y1 coordinate
32-HAsm(E5)
.Y2 coordinate
H+32sub(VL)
... Later in the code, as a subroutine:
Lbl VL
Asm(D1C1EBE3C501A0FF093856E3AFCB7C2803676F3CCB7A2805B72046575FAF0EC00930033D676FEB093005B72034626A7B953003ED44EB3C012C8F545D29192929095FC13E0747A157A90F0F0F4F094204AF3F1F10FD4F43110C0079B6771910FAC9E1)
Return


EDIT: I just realized that you could draw rectangles of width 1, too. It's slower than this routine, but it's built-in, simpler to use, and still a good deal faster at drawing vertical lines than the line routine.
Title: Re: Axe Raycaster
Post by: meishe91 on December 03, 2010, 07:24:47 pm
Wow, that is really neat :) Great job on it :D Keep up the good work. Can't wait to see what this leads too.
Title: Re: Axe Raycaster
Post by: squidgetx on December 03, 2010, 07:43:13 pm
And I was thinking....If only there was a super-optimized vertical line command ;)

Now if I am understanding your code correctly, Runer, I put Asm(E5) after the X coordinate, put the height into H, put Asm(E5) after the first Y coordinate, then the massive Asm() block in VL after the 2nd Y coordinate, right? Thanks....I'll be sure to credit you if this ever goes anywhere.

Next, scaled sprites.....

Oh and if anyone could help me with this bug/flaw in the algorithm:

You may notice that the height of the lines drawn on the screen are based on E, or R in the updated version, which is the length of the terminated ray. However, this is inaccurate: it should be based on the straight distance of the triangle instead:

______
|    /
|   /
|Z /
| /
|/
player

So you'd think that I'd then multiply the E (or R) value by cos(Z)/128, but it doesn't seem to be working...is there anything wrong with my trig?

Oh and @Scout David, the map isn't repeating :P the beginning just has two parts that are the same :P
Title: Re: Axe Raycaster
Post by: Runer112 on December 03, 2010, 09:15:13 pm
I noticed that bug/flaw too and tried to correct it, but it didn't work right for me.

I noticed another part of your code that could be improved upon, though. And this may actually be the cause of the above fix still not looking right. (Possibly not, though.) When you advance the ray, it doesn't always return a very accurate distance to the wall it collided with because of the relatively large, constant step system you use to advance the ray. You could reduce the step size, but then calculations would be much slower.

The method most commonly accepted as the quickest and most accurace raytracing method is to track where the ray hits cell boundaries. I'm not really sure how to explain it accurately without confusing both you and myself, so I made a picture instead.

The ideal method of tracing infinitely small steps is on the left. Your method of following a constant step size is in the middle. As you can see, the two illustrated rays will return the same length, although they clearly are not the same length. And the method that seems to be generally accepted as the best raytracing method is on the right. I've always had trouble wrapping my head around how to correctly implement that, but if you succeed, it should work quite well and speedily.
Title: Re: Axe Raycaster
Post by: Happybobjr on December 03, 2010, 10:24:43 pm
HOLY **** (sorry...)


Could this be used with my almost perfectly working (dumb cables) 2 player shooter game?

it runs quite fine in normal speed mode, so adding it with the full speed mode into this....
Title: Re: Axe Raycaster
Post by: Yeong on December 03, 2010, 10:25:21 pm
...will make CoD with Stimpack. ;D
Title: Re: Axe Raycaster
Post by: AngelFish on December 03, 2010, 10:26:53 pm
If you could figure out how to adjust the floor height, then it'd be perfect for games.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 03, 2010, 11:47:01 pm
WOAH This is really awesome and runs faster than I thought! Question, though: would it be possible to have it so walls are more diagonal-ish? I'm not sure how to explain it but I mean less blocky. Or would this be beyond Axe capabilities? Regardless, it would be nice to see a game using this. :)
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 06:22:48 am
WOAH This is really awesome and runs faster than I thought! Question, though: would it be possible to have it so walls are more diagonal-ish? I'm not sure how to explain it but I mean less blocky. Or would this be beyond Axe capabilities? Regardless, it would be nice to see a game using this. :)

I'd love to see a first person shooter like the already made Doom for the calculator :)

I'd like to see curved walls too!!
Title: Re: Axe Raycaster
Post by: Binder News on December 04, 2010, 09:42:57 am
OMG!!!!! This is amazing!! I was also thinking about doing something like this, but am doing something else right now. I agree with Scout David, an FPS would be great.
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 09:45:22 am
Quote
I was also thinking about doing something like this, but am doing something else right now

Philosophic thoughts :)

OMG!!!!! This is amazing!! I was also thinking about doing something like this, but am doing something else right now. I agree with Scout David, an FPS would be great.

Adding a gun to the character sprite wouldn't be very hard, but bullets in a Raycaster would be harder, due to the 3D effect of them
Title: Re: Axe Raycaster
Post by: ASHBAD_ALVIN on December 04, 2010, 11:03:16 am
looks great, I see yuo draw rectangles instead of blocks and stuff, which gives the raycaster a cool feel!  I'll see what I would be able to make out of it, application wise.
Title: Re: Axe Raycaster
Post by: Happybobjr on December 04, 2010, 03:07:03 pm
3d blockdude?
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:07:37 pm
3d blockdude?

wow, that would be epic, but a Raycaster Platformer would be insanely hard, there aren't that many for computers and consoles...
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:07:49 pm
3d pyyrix? O.o
Title: Re: Axe Raycaster
Post by: nemo on December 04, 2010, 03:13:49 pm
3d blockdude?

i'm already thinking about how you might do this, except make it true to block dude and move 8 pixels at a time. you know what'd be interesting? blockdude in first person. the maps would still be 2-D, and you would only be able to move back and forth.
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:18:38 pm
3d blockdude?

i'm already thinking about how you might do this, except make it true to block dude and move 8 pixels at a time. you know what'd be interesting? blockdude in first person. the maps would still be 2-D, and you would only be able to move back and forth.

Wow, like this in FPS:

(http://img530.imageshack.us/img530/9915/blockdude25d.png)
Made by me

Would need grayscale, right? Lots of it to make depth look real
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:19:35 pm
maybe grayscale, good idea, blocks closer in black, go further back they get lighter in color O.o
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:20:20 pm
maybe grayscale, good idea, blocks closer in black, go further back they get lighter in color O.o

(http://img530.imageshack.us/img530/9915/blockdude25d.png)

But big maps (example Level 9 in ti-83+ series original blockdude) would be really hard
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:20:47 pm
then maybe a map mode to see 2D as well?
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:21:51 pm
then maybe a map mode to see 2D as well?

(http://img530.imageshack.us/img530/9915/blockdude25d.png)


Press 'Mode' like in squidgetx's Raycaster, that would be perfect! Who's gonna make it? :P
Title: Re: Axe Raycaster
Post by: nemo on December 04, 2010, 03:22:40 pm
if i made it, i wouldn't have a map mode. that'd make the challenge lose value, personally.
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:23:00 pm
maybe me later on.  And please stop posting that picture over and over again :) j/k it's fine but irks me to see it 5 times in a row
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:25:27 pm
maybe me later on.  And please stop posting that picture over and over again :) j/k it's fine but irks me to see it 5 times in a row

That was on purpose, I knew it would annoy you :P
if i made it, i wouldn't have a map mode. that'd make the challenge lose value, personally.

Without the map 2D feature, it would be impossible, believe me. I can imagine the game without it. Of course, a zombie mode could be made without this feature :P
Title: Re: Axe Raycaster
Post by: Builderboy on December 04, 2010, 03:27:55 pm
I can imagine the game without it. Of course, a zombie mode could be made without this feature :P

Playing block dude while fighting off zombies! :O

On a more serious note, this looks amazing!  I didn't even think that Raycasting might be possible in Axe!  I can't wait to see where this goes! ;D
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:29:26 pm
It's very fast and would therefore be great for making games with it, because game engines on top of the fast 3D engine would still be pretty fast.  Also, I really do like how walls are rectangles, gives it a cuberunner felling :3
Title: Re: Axe Raycaster
Post by: nemo on December 04, 2010, 03:38:29 pm
maybe me later on.  And please stop posting that picture over and over again :) j/k it's fine but irks me to see it 5 times in a row

That was on purpose, I knew it would annoy you :P
if i made it, i wouldn't have a map mode. that'd make the challenge lose value, personally.

Without the map 2D feature, it would be impossible, believe me. I can imagine the game without it. Of course, a zombie mode could be made without this feature :P


impossible? nah. just difficult and frustrating. the picture shows what i'd imagine. the HUD indicates whether or not you are carrying a block. a black/white block cannot be picked up, a dark/light gray block can. so this picture indicates you are standing on a block you cannot pick up, facing a block you can pick up, which is facing a block you cannot pick up. and you are holding a block.
Title: Re: Axe Raycaster
Post by: Ikkerens on December 04, 2010, 03:46:28 pm
/me drools.
Ima go make Splut 3d xD
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:47:24 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=5547.0;attach=4785;image)

Yup, using several colours to display depth.
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 03:47:51 pm
/me is gonna go make black ops
Title: Re: Axe Raycaster
Post by: nemo on December 04, 2010, 03:49:13 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=5547.0;attach=4785;image)

Yup, using several colours to display depth.

mainly perspective, though.
and one more mockup i made, not as good:
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:49:45 pm
/me is gonna go make black ops

/me 's gonna make Blender: Calculator Version.
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 03:51:47 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=5547.0;attach=4788;image)

A new feature could also be added: instead of the player sprite falling down like this:




______________X
                        _________________

_______________
                        X_________________

Several frames and make it fall with some gravity
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 04:04:53 pm
double post, and that is a good idea, but here's the thing:

this isn't really a vertical raycasting engine from what I can see.  these are great ideas, but the engine seems a bit different.
Title: Re: Axe Raycaster
Post by: Runer112 on December 04, 2010, 04:12:34 pm
double post, and that is a good idea, but here's the thing:

this isn't really a vertical raycasting engine from what I can see.  these are great ideas, but the engine seems a bit different.

I was about to say, can we get back to the topic of this thread? If you want you can make a 3D blockdude thread and discuss it further in there.
Title: Re: Axe Raycaster
Post by: Ashbad on December 04, 2010, 04:14:05 pm
good idea.  So, is it possible for in the future for it to support things like stairs and different color walls and stuff?
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 04, 2010, 04:19:54 pm
Maybe start a new topic for Block Dude 3D? That said, I would like to see further development on raycasting. As for bullets, maybe it wouldn't be too hard, although I wonder how hard it would be to have sprite scaling...

Also Happybobjr why ddi you post a music program in this thread? ??? http://ourl.ca/8144/148999
Title: Re: Axe Raycaster
Post by: Munchor on December 04, 2010, 04:20:09 pm
double post, and that is a good idea, but here's the thing:

this isn't really a vertical raycasting engine from what I can see.  these are great ideas, but the engine seems a bit different.

I was about to say, can we get back to the topic of this thread? If you want you can make a 3D blockdude thread and discuss it further in there.

I am of the belief that we were arguing potential uses of this raycaster, but yeah we abused.

good idea.  So, is it possible for in the future for it to support things like stairs and different color walls and stuff?

So... Going up and down in the first person view (Stairs, jumps, elevators :D)
Title: Re: Axe Raycaster
Post by: squidgetx on December 05, 2010, 10:44:47 am
I've been busy all weekend and haven't gotten to physically work on anything yet, but I've figured out how to have the rays be more accurate in the way that you described, Runer. I'm glad to see everyone's excited about this, and I'll probably post an update tomorrow morning.

Also yes, this is a vertical raycaster, not a floorcaster :P. Different height-walls are possible, but are hard to deal with (I think not even calc84maniac was satisfied with his attempt). Apparently (for those of you who are familiar with the raycasting concept) you have to keep tracking the ray even after it hits a wall and it can get pretty messy
Title: Re: Axe Raycaster
Post by: Ashbad on December 05, 2010, 12:23:02 pm
yeah, then the speed drops and there's ability to add game engines on top of the raycasting engine...
Title: Re: Axe Raycaster
Post by: Munchor on December 05, 2010, 02:52:49 pm
We could also make maze games with this. Just an idea, though.
Title: Re: Axe Raycaster
Post by: willrandship on December 05, 2010, 03:46:40 pm
Well, bullets would be a lot simpler than you think. Problem is, you're thinking of having actual bullet objects. Early FPSs never did anything like this. They used whether or not you actually aimed at the enemy, and if you did, you hit them. No headshots either, since you can't look up or down :P

Also, vertical raycasters use almost identical code to horizontal ones (regarding rendering, not movement.)
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 05, 2010, 03:54:16 pm
I've been busy all weekend and haven't gotten to physically work on anything yet, but I've figured out how to have the rays be more accurate in the way that you described, Runer. I'm glad to see everyone's excited about this, and I'll probably post an update tomorrow morning.

Also yes, this is a vertical raycaster, not a floorcaster :P. Different height-walls are possible, but are hard to deal with (I think not even calc84maniac was satisfied with his attempt). Apparently (for those of you who are familiar with the raycasting concept) you have to keep tracking the ray even after it hits a wall and it can get pretty messy
Cool, I can't wait for next screenshots. Do you think you'll be able to make it look less blocky or would it be beyond Axe capabilities? I mean like in the mockup below:
Title: Re: Axe Raycaster
Post by: Munchor on December 05, 2010, 03:54:54 pm
(http://www.omnimaga.org/index.php?action=dlattach;topic=5547.0;attach=4800;image)

This would be sweet :)
Title: Re: Axe Raycaster
Post by: shmibs on December 05, 2010, 04:05:05 pm
dj: this looks like it's using detecting in large clumps or something similar instead of a ray for every pixel-column on the screen, so doing so in the conventional manner would probably slow things down quite a bit. however, such an effect could probably be achieved by drawing rotated cubes(which can be hardcoded for speed) at the object positions instead of just scaled squares. however, this is all speculation as i am just seeing this thread for the first time.

speaking of which... this is pretty freakin sweet, squidget!
Title: Re: Axe Raycaster
Post by: willrandship on December 05, 2010, 04:11:42 pm
That would make the floors and ceiling spiked instead...not sure if that would be better or worse.
Title: Re: Axe Raycaster
Post by: Happybobjr on December 05, 2010, 04:23:30 pm
the worst thing would be falling upon the spikes >:D

Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 05, 2010, 06:28:01 pm
dj: this looks like it's using detecting in large clumps or something similar instead of a ray for every pixel-column on the screen, so doing so in the conventional manner would probably slow things down quite a bit. however, such an effect could probably be achieved by drawing rotated cubes(which can be hardcoded for speed) at the object positions instead of just scaled squares. however, this is all speculation as i am just seeing this thread for the first time.

speaking of which... this is pretty freakin sweet, squidget!
Could it maybe draw every two line, like Nspire raycaster in low quality mode? It would look more pixelated but it would still look more 3D-ish.
Title: Re: Axe Raycaster
Post by: Snake X on December 05, 2010, 08:14:48 pm
dang I would *totally* try this out.. but alas.. all my 4 AAA batteries are gone :'(
Title: Re: Axe Raycaster
Post by: squidgetx on December 05, 2010, 08:37:05 pm
Basically I'm hoping that the distortion/blockiness problems will be fixed once I finish implementing the engine change and it *does* draw 1 line with its own height per ray cast so I'm hoping it'll fix itself when I finish the "update"
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 05, 2010, 09:19:14 pm
Cool! :D

I hope you can have a decent speed. If you ever add textures, maybe an RPG could be done with this?
Title: Re: Axe Raycaster
Post by: FinaleTI on December 05, 2010, 09:20:48 pm
Cool! :D

I hope you can have a decent speed. If you ever add textures, maybe an RPG could be done with this?
Funny. I was thinking the same thing.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 05, 2010, 11:24:40 pm
I thought it would be nice to maybe even have the character be shown, so it's kinda 2nd person view, even if you just see the top of the body. It could have turn-based battles too with enemies appearing in front of you, like the Tomb Raider clone for the 83+

As an RPG it would be fast enough I think.
Title: Re: Axe Raycaster
Post by: squidgetx on December 06, 2010, 07:09:00 am
ok update  ;D

much smoother, plus added fake lighting. note this is 15mhz speed, but still pure Axe (I haven't yet used Runer's asm code)
Title: Re: Axe Raycaster
Post by: shmibs on December 06, 2010, 08:18:46 am
it's lovely, squidget. i can't wait to use this for Game development

the walls nearest to the player still seem a bit wonky, though. are you clipping close walls to a maximum height?
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 06, 2010, 12:49:25 pm
Great! O.O

I agree with Shmibs, though, but otherwise it's really awesome! I also like how you have different wall shades (checkered and black). Nice job so far! ;D
Title: Re: Axe Raycaster
Post by: Builderboy on December 06, 2010, 01:51:58 pm
What you guys are noticing is the 'fishbowl effect', and can be remedied by multiplying the length of a cast ray by the cosine of the angle of the ray relative to the direction you are facing.  But it looks awesome and fast!  How exactly are you drawing the dithered walls so fast?  Is it greyscale? because it doesn't look to be alternating
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 06, 2010, 03:04:30 pm
Yeah it looks like monochrome to me. Would fixing the fishbowl effect slow things down a lot?
Title: Re: Axe Raycaster
Post by: ztrumpet on December 06, 2010, 04:13:09 pm
Wow, that looks wonderful!  Great job squidgetx! :woot:
Title: Re: Axe Raycaster
Post by: Builderboy on December 06, 2010, 04:47:17 pm
I don't think it should slow it down significantly, since its only a single multiplication for each ray, and you can prerender the cosine functions before you start the simulation.
Title: Re: Axe Raycaster
Post by: squidgetx on December 06, 2010, 06:09:51 pm
Weird, I thought I had fixed that bug...>.>

Yeah, the dithered walls are monochrome, though once I move from bit-maps to nibble or byte maps to accommodate different textures/colors and sprites, I might mess around with grayscale since then the backbuffer is free to use. The dithered walls are drawn the way you'd expect them to be drawn, with a simple
Code: [Select]
:For(Var,Start,End)
:If Var+(X^2)^2
:Pxl-On(X,Var)
:End

Also, remember that we're in 15 mhz mode right now, so the speed isn't quite so impressive (although it is still bearable in 6mhz mode)
Title: Re: Axe Raycaster
Post by: nemo on December 06, 2010, 06:25:41 pm
Weird, I thought I had fixed that bug...>.>

Yeah, the dithered walls are monochrome, though once I move from bit-maps to nibble or byte maps to accommodate different textures/colors and sprites, I might mess around with grayscale since then the backbuffer is free to use. The dithered walls are drawn the way you'd expect them to be drawn, with a simple
Code: [Select]
:For(Var,Start,End)
:If Var+(X^2)^2
:Pxl-On(X,Var)
:End

Also, remember that we're in 15 mhz mode right now, so the speed isn't quite so impressive (although it is still bearable in 6mhz mode)


couldn't that if statement be:
Code: [Select]
If X^2+Var^2
Title: Re: Axe Raycaster
Post by: squidgetx on December 06, 2010, 06:27:04 pm
Yes. Yes it could. I'm not sure why I wrote it like that :P
Title: Re: Axe Raycaster
Post by: calc84maniac on December 06, 2010, 06:34:44 pm
Even better, If X+Var^2 :)
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 06, 2010, 11:53:31 pm
Nice. By the way I tried the raycaster in Wabbitemu and the paths I walked through seemed really narrow. Is that normal? O.O
Title: Re: Axe Raycaster
Post by: Yeong on December 07, 2010, 06:56:11 am
just my opinion, but will the curved wall be possible later?(Like hills)
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 07, 2010, 02:46:05 pm
I think that might be beyond raycasting capabilities, but variable heights by blocks, not slopes, might be possible.
Title: Re: Axe Raycaster
Post by: AngelFish on December 07, 2010, 02:47:20 pm
just my opinion, but will the curved wall be possible later?(Like hills)

Not without some nice dithering code for monochrome.
Title: Re: Axe Raycaster
Post by: squidgetx on December 07, 2010, 08:06:53 pm
What exactly do you mean by 'curved walls' ?

Also, textures are hard x.x
Title: Re: Axe Raycaster
Post by: willrandship on December 07, 2010, 08:08:09 pm
Curved walls as in hills != raycasting as far as I understand it.

But, like DJ said, stuff like stairs. No curved tops.
Title: Re: Axe Raycaster
Post by: nemo on December 07, 2010, 08:09:07 pm
just my opinion, but will the curved wall be possible later?(Like hills)

Nope. curves cannot be supported by a raycaster due to their nature. the z-axis is locked. all walls must form a 90 degree angle with the floor.
Title: Re: Axe Raycaster
Post by: Builderboy on December 07, 2010, 08:10:43 pm
Not only must walls form a 90 degree angle with the floor, but also corners must be 90 degrees as well, so you can't have diagonal walls.
Title: Re: Axe Raycaster
Post by: willrandship on December 07, 2010, 08:12:02 pm
so, no octagon style wall shapes? Or do you mean ceiling parallel to floor?
Title: Re: Axe Raycaster
Post by: nemo on December 07, 2010, 08:12:58 pm
so, no octagon style wall shapes? Or do you mean ceiling parallel to floor?

this would be achieved by textures. i do wonder if transparent walls would be possible though...
Title: Re: Axe Raycaster
Post by: willrandship on December 07, 2010, 08:13:45 pm
That would depend on how collision detection worked.
Title: Re: Axe Raycaster
Post by: squidgetx on December 07, 2010, 08:16:00 pm
^Transparent walls would be easy, once I change the map storage from bits to nibbles or bytes: you can just have a wall that isn't detected by the raycasting part but is detected by the collision testing :P

Also, if you mean octagonal shape as in something like the US Pentagon, where it looks like a pentagon from the top but you walk around it looking at it from the side, then yes :P otherwise, not really
Title: Re: Axe Raycaster
Post by: nemo on December 07, 2010, 08:16:07 pm
i'm assuming it's by the rays traced. in which case, the ray would trace through a transparent wall as if it weren't there. you'd need two maps. one indicating whether or not you can walk, and on indicating wether or not the ray should be cast for those pixels.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 08, 2010, 03:07:49 am
Transparency walls would be great.

Also I wonder if there will be a new screenshot soon? :)
Title: Re: Axe Raycaster
Post by: squidgetx on December 08, 2010, 07:07:47 am
x.x So I'm running into some rather unavoidable issues: the current method of all testing for collision (of both the rays and the player) is with pxl-test on the backbuffer. Yesterday I tried changing the map to bytes, and using basic array checking ({Y*96+X+Pointer}) so that I could then add support for different types of walls (like the transparent ones), and it runs really slow, even after adding Runer's assembly code. I can't think of any way to improve it

It's not unbearably slow, but I can tell that if I decided to add textures or scaled sprites, it probably wouldn't make it :(

Progress will continue, but at the best I think we're only going to see 4bit variation in the wall 'types' (done by or-ing two buffers over each other)

edit: Another alternative could be to reduce the screen size, like in Gemini, but I'm kind of iffy on that :P
Title: Re: Axe Raycaster
Post by: Ashbad on December 08, 2010, 07:10:39 am
too bad, I would be fine with the fast old version instead.

but great job anyways so far, I could never do most of this.
Title: Re: Axe Raycaster
Post by: squidgetx on December 08, 2010, 07:13:01 am
Yeah, I'm sure the fast old version will be good enough for anyone wanting to make something; I haven't played gemini in a while, but I know that Doom only has 1 color of wall :P

Meanwhile I'm going to work on textures x.x
Title: Re: Axe Raycaster
Post by: Ashbad on December 08, 2010, 07:14:26 am
good luck! :D
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 08, 2010, 02:51:07 pm
Couldn't you just reduce the resolution, but not the screen size? That might double the speed. However, textures aren't really necessary I think. Do you think adding sprites would be hard, btw? (If they are scaled, I would recommend that each possible zoom is pre-rendered and stored into memory prior starting a level to speed rendering up.
Title: Re: Axe Raycaster
Post by: Munchor on December 08, 2010, 02:55:51 pm
Here it is: Doom 83, French version.

However, I really suck in the emulator.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 08, 2010, 04:09:58 pm
Wow this is ancient. O.O. There's a much up to date version called zDoom on ticalc.org. It still has some glitches, though. Cool game nonetheless. I wish it was finished. I remember reading the site regularly back in 2001 and 2002. http://doom83.free.fr/
Title: Re: Axe Raycaster
Post by: Munchor on December 08, 2010, 04:12:09 pm
Wow this is ancient. O.O. There's a much up to date version called zDoom on ticalc.org. It still has some glitches, though. Cool game nonetheless. I wish it was finished. I remember reading the site regularly back in 2001 and 2002. http://doom83.free.fr/

A website for a calculator game? Wow, that's epic :D
Title: Re: Axe Raycaster
Post by: ztrumpet on December 08, 2010, 04:48:56 pm
Why don't you keep doing it the way you were doing it (bits for drawing), but have another bit-based tilemap for collision detection?  In effect, two tilemaps.
Title: Re: Axe Raycaster
Post by: Builderboy on December 08, 2010, 04:59:01 pm
96 isn't on the auto optimization list, try doing *32*3 instead and it should be much faster :) Technically speaking, pixel testing is usually slower than byte reading, since with pixel testing you are doing bit shifts and bit testing.  also, if your map was like 64x64, it would be even faster since you could then do *64 which is extremely fast :)

On a related note, check out this FPS that BenRyves Made O.O
(http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrough.gif)
Title: Re: Axe Raycaster
Post by: ztrumpet on December 08, 2010, 05:08:51 pm
Wow, where's a link to that?  It looks great! ;D
Title: Re: Axe Raycaster
Post by: Builderboy on December 08, 2010, 05:10:11 pm
Right here http://www.benryves.com/ :)
Title: Re: Axe Raycaster
Post by: calcdude84se on December 08, 2010, 05:10:32 pm
http://benryves.com/ (http://benryves.com/) The download link is in the blog post on the main page :)
Link to current version: http://benryves.com/images/nostromo/bsp/2010.11.28/Nostromo.zip (http://benryves.com/images/nostromo/bsp/2010.11.28/Nostromo.zip)
Edit: ninja'd
Title: Re: Axe Raycaster
Post by: squidgetx on December 08, 2010, 05:36:41 pm
Holy crap.

btw, I'm going to clarify in case this wasn't clear from the beginning, this project is intended to allow other people to make 3d games with Axe, it's an engine. Of course, I might end up making something with it myself, but it is open source and anyone can use the code to make their own game as long as you credit me appropriately ;)

Couldn't you just reduce the resolution, but not the screen size? That might double the speed. However, textures aren't really necessary I think. Do you think adding sprites would be hard, btw? (If they are scaled, I would recommend that each possible zoom is pre-rendered and stored into memory prior starting a level to speed rendering up.

That's an interesting idea, and wouldn't be hard to implement. Sprites I think wouldn't be too hard as long as they are prerendered to a specific set of sizes. I think it should support a couple sizes: probably two sizes, large and small. (as in a small object like the barrels in Doom and the big enemies along with their respective zoom levels) What do you guys think?

Also I will try that optimization, and probably will change the map to 64x64. I was surprised that the byte checking was so much slower as well. However all these changes will mean that I'm going to have to create a map editor/sprite editor, which might take a little while. :P

EDIT: However, first I want to tighten up the raycasting process as described on the 1st page by Runer112, and get rid of the fishbowl effect. Also I think I get how to do textures now, but I have to do the above stuff first :P
Title: Re: Axe Raycaster
Post by: willrandship on December 08, 2010, 06:04:15 pm
Hooray! That's actually similar to what I was thinking for my CT battle engine.
Title: Re: Axe Raycaster
Post by: Munchor on December 08, 2010, 06:21:32 pm
(http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrough.gif)

This looks really good!
Title: Re: Axe Raycaster
Post by: willrandship on December 08, 2010, 06:23:30 pm
That's an asm engine that was written by benryves that appears to be a true 3d one, (at least a bit more 3d :P) since you can look up and down.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 08, 2010, 10:55:39 pm
(http://benryves.com/images/nostromo/bsp/2010.11.28/Walkthrough.gif)

This looks really good!
Indeed O.O I really need to post a news about this soon.

Ben was working on this years ago but stopped, and now he appears to have resumed it.

@Squidgetx Two sizes sounds good for objects, although I wonder if it would look weird with large enemies.
Title: Re: Axe Raycaster
Post by: willrandship on December 08, 2010, 11:10:31 pm
what the...I saw 55 fps at one point.
Title: Re: Axe Raycaster
Post by: AngelFish on December 08, 2010, 11:12:45 pm
That's an asm engine that was written by benryves that appears to be a true 3d one, (at least a bit more 3d :P) since you can look up and down.

Where is that available!
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 08, 2010, 11:14:46 pm
what the...I saw 55 fps at one point.
Like with computer FPSes, when you're closer to walls there is less stuff to render and check, I think, which is why framerate increases. Notice how in many computer games, speed gets smoother when you approach a wall.
That's an asm engine that was written by benryves that appears to be a true 3d one, (at least a bit more 3d :P) since you can look up and down.

Where is that available!
http://benryves.com/images/nostromo/bsp/2010.11.28/Nostromo.zip
Title: Re: Axe Raycaster
Post by: AngelFish on December 08, 2010, 11:21:31 pm
I very much want this ;D
Title: Re: Axe Raycaster
Post by: jnesselr on December 09, 2010, 07:22:57 am
That .gif file almost crashed my browser. (It doesn't handle huge .gifs well, and at 1678 frames, well, it's kinda huge) Otherwise, though, I think that's one of the best 3d engines I've ever seen. I can never seem to do 3d from a first person view. Only looking at a model or something.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 09, 2010, 09:41:41 am
What browser do you use Graph? I think I remember IE for Mac playing animated GIFs slowly and some sites crashing when too many images had to be displayed.
Title: Re: Axe Raycaster
Post by: Munchor on December 09, 2010, 09:42:44 am
That .gif file almost crashed my browser. (It doesn't handle huge .gifs well, and at 1678 frames, well, it's kinda huge) Otherwise, though, I think that's one of the best 3d engines I've ever seen. I can never seem to do 3d from a first person view. Only looking at a model or something.

What browser do you use Graph? I think I remember IE for Mac playing animated GIFs slowly and some sites crashing when too many images had to be displayed.





May I bet on IE??
Title: Re: Axe Raycaster
Post by: squidgetx on December 09, 2010, 07:18:37 pm
Okay, figured out generally what's wrong with the engine. It involves the necessity of scaling all my numbers by 128*8 rather than 128, so I think the engine will need to be (almost) completely rewritten. It shouldn't be too difficult though :P
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 09, 2010, 08:38:04 pm
Ouch, I hope it's not too hectic X.x. Good luck!
Title: Re: Axe Raycaster
Post by: squidgetx on December 10, 2010, 05:54:26 pm
It's getting a *little* hectic. It took me a while to figure out how to accurately compensate for the lack of a tan and cot function :P, and that's only the tip of the iceberg :P

I'm going to do some minor improvements and add sprites just for functionality testing, and call it an alpha. Then I'll work on rewiring the engine for less distortion, more accuracy, textures, and a world editor (sprites and map) which will probably be more of an on/off project depending on how things with my other projects are going.

Regarding sprites, do we think it would be better for the user to to have to make like 10 sizes of the same sprite, or only two or three and have the engine scale them by 2x and 4x? It's a question of detail versus less hassle on the user end :P
Title: Re: Axe Raycaster
Post by: willrandship on December 10, 2010, 10:46:13 pm
how many levels can axe scale through? If you submitted one 64x64, you could squash 10 sizes out of that. Axe can do that now, can't it?
Title: Re: Axe Raycaster
Post by: ztrumpet on December 10, 2010, 11:25:51 pm
It's getting a *little* hectic. It took me a while to figure out how to accurately compensate for the lack of a tan and cot function :P, and that's only the tip of the iceberg :P
tan x = sin x / cos x and cot x = cos x / sin x if you didn't already know this. ;)

Sounds great!  I can't wait for more progress. ;D

Regarding sprites, do we think it would be better for the user to to have to make like 10 sizes of the same sprite, or only two or three and have the engine scale them by 2x and 4x? It's a question of detail versus less hassle on the user end :P
I think the user should have to make multiple copies.  This would be quicker and easier for your code, and also more precise than a general algorithm. :D
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 11, 2010, 01:02:21 am
Same as what Ztrumpet said. I hope you don't run into any major bugs halting development considerably too. A raycaster or anything involving 3D really seem hectic to code. X.x
Title: Re: Axe Raycaster
Post by: squidgetx on December 11, 2010, 01:31:51 pm
@ztrumpet: That's a problem though, since sinx / cosx and cosx / sinx actually comes out to either 0 or 1. So you actually have to inflate the first term by 128 (or some other factor) and then don't forget about the signed division :P Additionally, my problem was that not only did I have to scale by 128, I had to scale by 128 or -128 depending on which direction you were facing

@ztrumpet/DJ. I guess that would be good

@willrandship: How do you mean? Is there a scaling command?
Title: Re: Axe Raycaster
Post by: willrandship on December 11, 2010, 01:39:17 pm
I think so.....hang on.

Hmm, guess not. I'd thought someone had mentioned scaling in an old thread.

Oh XD it was a thread about asm, not axe. :P sorry.
Title: Re: Axe Raycaster
Post by: FinaleTI on December 11, 2010, 01:49:31 pm
Scaling in Axe? (http://ourl.ca/6016/93670)
Title: Re: Axe Raycaster
Post by: willrandship on December 11, 2010, 01:54:18 pm
Yeah, that might have been part of what confused me :P but that one only talks about enlarging sprites, not shrinking them.
Title: Re: Axe Raycaster
Post by: squidgetx on December 11, 2010, 01:54:48 pm
Hm, looks interesting. I think I'll go with making the user draw all the different zoom levels though, or possibly have the auto scale be an option
Title: Re: Axe Raycaster
Post by: ztrumpet on December 12, 2010, 10:20:53 pm
@ztrumpet: That's a problem though, since sinx / cosx and cosx / sinx actually comes out to either 0 or 1. So you actually have to inflate the first term by 128 (or some other factor) and then don't forget about the signed division :P Additionally, my problem was that not only did I have to scale by 128, I had to scale by 128 or -128 depending on which direction you were facing
Ah, I see.  That's quite difficult.  Nice job on that. ;D
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 13, 2010, 03:59:19 pm
Scaling really has to be pre-rendered. Rendering a sprite takes 0.1 second, meaning if there are 10 sprites on the screen, your game run a bit under 1 FPS.
Title: Re: Axe Raycaster
Post by: willrandship on December 13, 2010, 08:01:24 pm
I take it you mean scaling a sprite takes .1 seconds? That's really horrible for realtime rendering, but I suppose you could prescale them as it starts if you're super desperate for space.
Title: Re: Axe Raycaster
Post by: DJ Omnimaga on December 14, 2010, 03:48:46 pm
Yeah 0.1 second, as shown in my screenshot in the linked topic. This is why they need to be pre-rendered. When entering a room with new sprites they should probably be pre-rendered there.