Author Topic: Nspire Raycaster  (Read 105247 times)

0 Members and 3 Guests are viewing this topic.

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: Nspire Raycaster
« Reply #165 on: April 05, 2010, 02:50:11 am »
Great! it works!

Also did you check if you get a slow down if when in 50% resolution (160x120) or even 25% (80x60) you scale the screen up by 2x or 4x?

(mockups below):
« Last Edit: April 05, 2010, 02:55:48 am by DJ Omnimaga »

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #166 on: April 05, 2010, 03:50:52 am »
I remember scaling a 160x120 up to 320x240 a while ago. It wasn't any slower (because since the ratio is 1:2, I can just fill in 4 pixels for every calculated pixel).
I might render every other column instead of scaling up a half-sized screen, though (so I'd get a 2x increase in speed).

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: Nspire Raycaster
« Reply #167 on: April 05, 2010, 03:54:10 am »
Aaah ok. It's up to you I guess. I assumed filling 16 pixels with the same thing wouldn't take much processing power compared to calculting the raycasting for each 16 pixels but I was not sure

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Nspire Raycaster
« Reply #168 on: April 05, 2010, 07:14:40 am »
Attached is a CAS-compatible demo
Thank you for this, but... it doesn't works.
the file make the nspire reboot just after a key enter (instead of the non CAS file which bugs just after loading)
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #169 on: April 05, 2010, 06:02:01 pm »
Try the new CAS version attached.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Nspire Raycaster
« Reply #170 on: April 05, 2010, 11:57:53 pm »
Will adding multiple tile height be very difficult?  That would mean that the ray wouldn't stop at the first tile it reaches, but keeps going until... ?  And would it slow down the engine having to draw multiple scaled textures per column?

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: Nspire Raycaster
« Reply #171 on: April 06, 2010, 12:02:43 am »
my worry was if you can walk on multiple floors/jump on them, it would get very confusing with the entire floor being a plain color, right? I mean when looking towards a pit, you wouldn't be able to distinguish the bottom floor from the top one

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #172 on: April 06, 2010, 12:07:22 am »
Latest trivial update!
Press [Enter] to toggle rendering only every other column (you might have to try a couple times to make it work; the keys don't have any delay so it is possible to switch it on and then off again in one keypress).

@Builderboy:The speed concern is why I have implemented drawing every other column (free 2x speed gain at the cost of a negligibly uglier result).

@DJ Omnimaga: The floors will all be separated by textured walls, so no two floors will ever intersect.
« Last Edit: April 06, 2010, 12:09:34 am by bwang »

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: Nspire Raycaster
« Reply #173 on: April 06, 2010, 12:54:02 am »
aaah ok thanks for info, I'll try this update soon!


EDIT: GAH at Notepad not opening Linux and Mac readmes properly x.x, I hate having to right-click, open with wordpad all the time. Oh well

Btw there's a huge speed increase in lower quality mode and the quality drop isn't too bad. Nice
« Last Edit: April 06, 2010, 03:34:23 am by DJ Omnimaga »

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: Nspire Raycaster
« Reply #174 on: April 06, 2010, 07:24:01 am »
@DJ Omnimaga: The floors will all be separated by textured walls, so no two floors will ever intersect.
What about a higher floor, then a lower floor? Then the textured wall is facing away from you, and cannot be seen. Example from the raycaster I wrote a while back in Python:

As you can see, I solved this problem by making the floor a different shade on each level.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

SirCmpwn

  • Guest
Re: Nspire Raycaster
« Reply #175 on: April 06, 2010, 08:29:39 am »
^I opened this thread, and my jaw dropped until I realized that screenshot wasn't from the TI-Nspire raycaster.

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: Nspire Raycaster
« Reply #176 on: April 06, 2010, 02:20:21 pm »
@DJ Omnimaga: The floors will all be separated by textured walls, so no two floors will ever intersect.
What about a higher floor, then a lower floor? Then the textured wall is facing away from you, and cannot be seen. Example from the raycaster I wrote a while back in Python:

As you can see, I solved this problem by making the floor a different shade on each level.
Yeah that's what I meant, basically. I was worried about that. Would it be slow to rended such floor, even with no floor textures?

@SirCmpwn lol what did you expect? XD It's a gaming consol... er... calculator, after all ;)

Offline AaroneusTheGreat

  • Moderator
  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 287
  • Rating: +26/-1
    • View Profile
Re: Nspire Raycaster
« Reply #177 on: April 06, 2010, 07:30:20 pm »
While it does take a bit of calculations for filling a space with a solid color, it's still much faster than a floor texture due to the fact that you're only calculating the size of the space to be filled and setting those pixels to a color, rather than finding the pixel in the texture for each pixel on the floor, then drawing the corresponding color of the texture to that pixel.

A solid color still requires extra calculations in the engine versus no floor, but it's a better alternative than a textured floor on a platform like this. A creative client programmer can make the resulting game look just as good as with floor textures, by compensating for the less complex image by using more interesting wall textures and more sprite objects in the level to suggest themes for rooms and areas. Plus having a background image will add to the illusion that you are inside, making the space seem larger than it actually is.

Also if the background image scrolls with the player's rotations, the rotation of the walls around the camera will look more realistic.
« Last Edit: April 06, 2010, 07:30:47 pm by AaroneusTheGreat »

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #178 on: April 06, 2010, 07:57:43 pm »
Really trivial update attached changes the quality keys to H and L.

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: Nspire Raycaster
« Reply #179 on: April 06, 2010, 10:53:59 pm »
Also if the background image scrolls with the player's rotations, the rotation of the walls around the camera will look more realistic.
One thing to make sure is that it also scrolls at a reasonable speed, too. In the past, I saw calc 3D engines where the background scrolled twice slower than you turned around, or at the same speed as far away walls when rotating. It doesn't look much realistic. The background should probably scroll at 1.5x or twice the speed at least