Author Topic: raycasting texture  (Read 16939 times)

0 Members and 2 Guests are viewing this topic.

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
raycasting texture
« 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)



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 ^^)



EDIT : the game run at full with a little pause ^^ it's very not fast ^^
« Last Edit: October 09, 2012, 10:59:16 am by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #1 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.
« Last Edit: October 04, 2012, 04:35:28 pm by MGOS »

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #2 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 ;)
« Last Edit: October 04, 2012, 04:17:37 pm by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: raycasting texture
« Reply #3 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.

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #4 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?
« Last Edit: October 04, 2012, 04:24:27 pm by MGOS »

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #5 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 :)
« Last Edit: November 01, 2012, 04:23:20 pm by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: raycasting texture
« Reply #6 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.

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #7 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.

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #8 on: October 04, 2012, 04:30:55 pm »
no ^^ I would write the line of the texture in a differente size... how make this ?
« Last Edit: October 30, 2012, 07:17:35 am by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #9 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.

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #10 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.
« Last Edit: October 04, 2012, 04:47:00 pm by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #11 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?

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #12 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
« Last Edit: October 04, 2012, 04:52:44 pm by nikitouzz »
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes

Offline MGOS

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +95/-0
    • View Profile
Re: raycasting texture
« Reply #13 on: October 04, 2012, 04:52:19 pm »
Are you doing clrdraw every frame? That would make the pxl-Off redundant.

Offline nikitouzz

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 215
  • Rating: +22/-1
    • View Profile
Re: raycasting texture
« Reply #14 on: October 04, 2012, 04:53:46 pm »
yes I use the routine of runer112 than faster clrdrawn per frame
mes records personels :

2x2x2 : 2.18 secondes / 2x2x2 une main : 21.15 secondes / 2x2x2 yeux bandés : 47.59
3x3x3 : 5.97 secondes / 3x3x3 une main : 49.86 secondes
4x4x4 : 1.49 minutes / 4x4x4 une main : 6.50 minutes
5x5x5 : 4.10 minutes / 5x5x5 une main : 18.02 minutes
6x6x6 : 8.10 minutes
7x7x7 : 16.03 minutes
9x9x9 : 58.26 minutes

megaminx : 5.59 minutes / pyraminx : 7.91 secondes / square-one : 1.07 minutes