Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: nikitouzz on October 04, 2012, 03:54:15 pm

Title: raycasting texture
Post by: nikitouzz on October 04, 2012, 03:54:15 pm
Hi , I made a game with use the raycasting :) i would make a texture, but my texture bug completely ^^ (I'm french)

(http://desmond.imageshack.us/Himg221/scaled.php?server=221&filename=3d1s.gif&res=landing)

I have this sprite :
[AA55AA55AA55AA55]->pico and i would extract the line corresponding at the modulo of the position of the ray between 0 and 7 :)

and how drawn a line from different size ? my solutions is extremely big and very not fast....

thank's :)

cordially



YESSSSSSSSSSSSSSSS the textur function ;) and I make a little floorcasting ^^ ( it is not a right floorcasting ^^)

(http://imageshack.us/scaled/landing/59/3d3p.gif)

EDIT : the game run at full with a little pause ^^ it's very not fast ^^
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:10:53 pm
To get the vertical line, just rotate the sprite 90 degrees right and then you add the line you want. The result is the vertical line from bottom to top.

Code: [Select]
[whatever your sprite is]->Pic0
.L is the line number (0=leftmost, 7=rightmost)
{RotC(Pic0)+L}->V
.V is the bit mask of the vertical line. MSB = bottom pixel, LSB = top pixel

EDIT: When you only use that sprite you said it doesn't need to be turned because it is the same then.

And L (without *8 ) should be correct.
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:13:54 pm
:O rotate the sprite is a very good solution :) thank's most :)

EDIT : it's L*8 not L ;)
Title: Re: raycasting texture
Post by: DJ Omnimaga on October 04, 2012, 04:18:22 pm
On an off-topic note, I like how the texture has no outline in the screenshot above. I wish more raycasters used such textures so games won't always look like you are in a tunnel.
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:19:42 pm
Yeah, it is probably the fastest way to do it. If you don't need the sprites anywhere else, just store them rotated. That is faster and takes less memory. ;)

Btw, your raycaster looks awesome so far. I built one myself last week. Does yours run at 6 mHz or at 15 mHz?
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:23:34 pm
dj'o : it's bug :p but if you love the texture I can make two programm with one witch have this texture ;)

can you answer at my second question please ? ^^ if you know :)
Title: Re: raycasting texture
Post by: DJ Omnimaga on October 04, 2012, 04:27:52 pm
Yeah I know. I just thought the lack of an outline made it unique lol. And sadly I can't help since I never used raycasting before.
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:28:14 pm
can you answer at my second question please ? ^^ if you know :)

What do you mean with a "a line with a different size"? One that is wider than one pixel?
When you only need vertical or horizontal lines, you should use the Rect( command. It is a lot faster than Line( and you can adjust the width.
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:30:55 pm
no ^^ I would write the line of the texture in a differente size... how make this ?
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:33:04 pm
I don't know, can you post the solution you came up with so maybe we can optimize that.
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:37:12 pm
I extract the number (1 or 0) and i divise the size of line by 8 enregistred in W and I drawn the pixels multiplicated by the number W ...it's very long...

:for(8 )
:Size/8->W
:extract the number (with routine unoptimisable) 0 or 1
:for((0 or 1)+W)
:pxl-on(X,Y) or pxl-off(X,Y)
:Y++
:End
:End

i make this, I don't post the code in the totality because my 84+ is not accessible.
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:41:44 pm
Why do you have to multiply with W at the end? I don't get the point of that. Can you post that part of your code?
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:48:44 pm
Code: [Select]
:for(8 )
:extract the number (with routine unoptimisable)->W
:for(Size/8)
:W=1?pxl-on(X,Y)
:W=0?pxl-off(X,Y)
:Y++
:End
:End
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:52:19 pm
Are you doing clrdraw every frame? That would make the pxl-Off redundant.
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 04:53:46 pm
yes I use the routine of runer112 than faster clrdrawn per frame
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 04:55:11 pm
Which routine?
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 05:00:22 pm
Code: [Select]
ᴇ80FF→{L₆+11}ʳ
Copy(L₆+11,-1,11)ʳ
Copy(,L₆+756,12)
ᴇ0100→{L₆+22}ʳ
Copy(L₆+22,-1,9)ʳ
Copy(-1,+12,61*12)
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 05:05:48 pm
But this clears the whole screen, right?
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 05:11:08 pm
yes the whole screen
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 05:14:30 pm
Ok then maybe do something like this:

Code: [Select]
H/8->S   .H is the wall height in pixels
For(8)
If pixel is set
Rect(X,Y,S,1)
End
Y+S->Y
End
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 05:23:02 pm
thank,s :) can make :

Code: [Select]
H/8->S   .H is the wall height in pixels
For(8)
If pixel is set
Rect(X,Y,S+Y->Y,1)
End
End

I will try morning :) thank's :)
Title: Re: raycasting texture
Post by: MGOS on October 04, 2012, 05:28:36 pm
To test if whether a pixel is set you could make a simple routine that shifts the byte right by one and checks for carry.
Title: Re: raycasting texture
Post by: nikitouzz on October 04, 2012, 05:37:01 pm
yes i will think's about tomorrow :) thank's
Title: Re: raycasting texture
Post by: MGOS on October 05, 2012, 10:37:47 am
Drawing the text on the right side every frame is very slow. You should draw it once before the game and then only clear the 64x64 px area. You could use Copy(, Fill( and/or a for( loop to achieve that.
Title: Re: raycasting texture
Post by: nikitouzz on October 05, 2012, 11:08:33 am
non i use one simple routine :

Code: [Select]
:0→r1
:for(768)
:{str1+r1} or {L6+r1→r2}→r2
:r1++
:End

I define the pic in the calculator before the compilation, beacause the command text() or text is very slow....

in the begin, I clrear the 64x64 part of the screen par frame but it's not fast
Title: Re: raycasting texture
Post by: MGOS on October 05, 2012, 11:32:46 am
Ah, that makes sense now. Have you tested the version with Rect(?
Title: Re: raycasting texture
Post by: nikitouzz on October 05, 2012, 01:02:29 pm
yes, I don't understand because one i have one bugs in rapport with the size of line... i think's that monday this bug will be solved :) ( grammar is horrible ^^ )
Title: Re: raycasting texture
Post by: TIfanx1999 on October 05, 2012, 06:18:25 pm
I agree with DJ, I think the texture bug makes a neat visual effect. ^^
Title: Re: raycasting texture
Post by: Sorunome on October 05, 2012, 09:35:28 pm
Same here, it's looking nice that way :D
Title: Re: raycasting texture
Post by: nikitouzz on October 06, 2012, 04:43:53 am
;) I don't understand all the message and google translation is not my friends ;) but thank's

HS: all people like the pony ? :) as juju :)
Title: Re: raycasting texture
Post by: annoyingcalc on October 06, 2012, 07:36:57 pm
im not sure why ponys are all the rage but what is your first langauge? I think I might be able to show you some tips on shortened messages that arent understood by google translate
Title: Re: raycasting texture
Post by: nikitouzz on October 07, 2012, 10:01:31 am
I'm frenche, i speack little english, but I don't like google translate
Title: Re: raycasting texture
Post by: TIfanx1999 on October 07, 2012, 02:42:41 pm
Understandable. Google translate is pretty terrible. D:
Title: Re: raycasting texture
Post by: nikitouzz on October 08, 2012, 05:38:47 pm
I make a texture ;)

(http://imageshack.us/scaled/landing/59/3d3p.gif)
Title: Re: raycasting texture
Post by: DJ Omnimaga on November 07, 2012, 04:54:34 pm
Looks very nice. I like how youhave it so it is not full wall height. :)

If only raycasting in Axe supported transparency at a decent framerate, you could even have  a background.
Title: Re: raycasting texture
Post by: nikitouzz on November 07, 2012, 06:05:08 pm
hum I see as i make....

I succed the greyscale of my raycaster but isn't beautiful, because my programms is very slow...
Title: Re: raycasting texture
Post by: ben_g on November 09, 2012, 04:35:51 pm
If you want beautifull grayscale, you can put the dispgraph^r in an interrupt routine
Title: Re: raycasting texture
Post by: Hayleia on November 10, 2012, 01:47:22 am
If you want beautifull grayscale, you can put the dispgraph^r in an interrupt routine
Yeah, ^This (http://ourl.ca/17145/318621) ;)
Title: Re: raycasting texture
Post by: DJ Omnimaga on November 10, 2012, 03:40:10 pm
What about when the next frame is loaded (assuming he moves or that there is stuff moving on the screen)? Wouldn't there be flickering everytime he moves around?
Title: Re: raycasting texture
Post by: nikitouzz on November 10, 2012, 03:50:29 pm
ben_G :i t's very difficult, because I use one special technical for draw the pixels ^^ and I draw all the pixels througout the loop directly in the L6 list...

no Dj_o :)