Author Topic: [Lua] RayCaster  (Read 38888 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [Lua] RayCaster
« Reply #75 on: July 26, 2011, 02:11:58 pm »
Nice, I'm looking forward to it!

Offline cypressx1

  • LV3 Member (Next: 100)
  • ***
  • Posts: 45
  • Rating: +0/-0
    • View Profile
Re: [Lua] RayCaster
« Reply #76 on: July 27, 2011, 07:36:24 am »
me too!

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Lua] RayCaster
« Reply #77 on: July 27, 2011, 11:45:34 am »
Yep, it definitely looks cool to have a 3D random puzzle game, congrats :)

looking forward to see it ! (the game, and the code :P)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: [Lua] RayCaster
« Reply #78 on: July 27, 2011, 12:31:46 pm »
Can't wait for it :D

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Lua] RayCaster
« Reply #79 on: July 27, 2011, 02:27:19 pm »
I was reading earlier in the topic and it was said that textures would be impossible to do quickly in Lua. But can't you exploit the image.copy() function? You could store each column of the texture as a TI.image, and select one of these columns depending on where the wall is intersected. Then, instead of doing something like:
Code: [Select]
gc:drawRect(x, y, xwidth, yheight)
You could do:
Code: [Select]
gc:drawImage(image.copy(columnImage, xwidth, yheight), x, y)
This is probably a bit slower than just drawing a rectangle, but I can't imagine it being as slow as drawing textures manually.

Edit: Removed extra closing parentheses
« Last Edit: July 27, 2011, 02:35:33 pm by calc84maniac »
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [Lua] RayCaster
« Reply #80 on: July 27, 2011, 05:16:20 pm »
That would be a lot of TI.images :P

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Lua] RayCaster
« Reply #81 on: July 27, 2011, 07:37:03 pm »
That would be a lot of TI.images :P
Nobody has to know if you keep them in an array, hehe
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [Lua] RayCaster
« Reply #82 on: July 27, 2011, 08:32:37 pm »
What has this world come to? Images in arrays? Blasphemy!
You can put images in matrices now? *.*

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Lua] RayCaster
« Reply #83 on: July 27, 2011, 08:35:11 pm »
Well, Lua uses tables. You can put anything you want in a table, I'm pretty sure.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: [Lua] RayCaster
« Reply #84 on: July 27, 2011, 09:48:28 pm »
Yeah, you can put everyhing in a table :P

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Lua] RayCaster
« Reply #85 on: July 28, 2011, 01:10:40 am »
You can also use jimbauwens' ti.image compression algorithm %)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Chockosta

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 447
  • Rating: +169/-6
    • View Profile
Re: [Lua] RayCaster
« Reply #86 on: July 28, 2011, 08:26:07 am »
I can try, but I don't have too much hope.
TI.images are awfully slow. Look at my Bobby Carrot : when there are not too much sprites, the drawing is fast. But when there are more than 50 sprites (30*30 pixels), you have to wait more than 1 sec before the screen is refreshed.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [Lua] RayCaster
« Reply #87 on: July 28, 2011, 10:26:24 am »
Then that's no good. :( Even rendering every other column, that's still 160 images. I'm not too surprised, as that was supposed to be a general purpose routine for displaying a few images here and there, not optimized for speed.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: [Lua] RayCaster
« Reply #88 on: July 28, 2011, 11:22:01 am »
[ i'm not saying anything, okay ? ]

TI.Image will be faster in the future (very probably) thanks to [ that I really can't say ]

[ / oops what did I just say ]
« Last Edit: July 28, 2011, 11:22:15 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: [Lua] RayCaster
« Reply #89 on: July 28, 2011, 11:24:55 am »
[ i'm not saying anything, okay ? ]

TI.Image will be faster in the future (very probably) thanks to [ that I really can't say ]

[ / oops what did I just say ]
:o ... interesting