Author Topic: Nspire Raycaster  (Read 94342 times)

0 Members and 1 Guest are viewing this topic.

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 #60 on: March 26, 2010, 07:33:37 pm »

puǝ
puǝ
(ɐ)sןǝxıdʍɐɹp
(ʇuǝɯbǝs ɟo ʇɥbıǝɥ)ɹoɟ
ɐ>-ɹoןoɔɔןɐɔ
(13 oʇ 0)ɹoɟ

:buıʞuıɥʇ ɯ,ı ʇɐɥʍ ɹoɟ ǝpoɔopns ǝɯos ǝʞıן

o˙o sןǝxıd ǝɹoɯ oʇ buıʍɐɹp ǝɹɐ noʎ ǝsnɐɔǝq ʎןǝɹǝɯ ssoן pǝǝds ǝɥʇ sı ɹo   ¿ǝɹnʇxǝʇ ǝɥʇ ɟo uoıʇɔǝs ɥɔɐǝ ɹoɟ ǝuo  ¿sǝɯıʇ 23 ʎןuo uɯnןoɔ ɥɔɐǝ ɹoɟ ǝɹnʇxǝʇ ǝɥʇ pǝʇɐןnɔןɐɔ noʎ ɟı dןǝɥ ʇı pןnoʍ
« Last Edit: April 01, 2010, 12:43:29 am by Builderboy »

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #61 on: March 26, 2010, 07:56:06 pm »
The speed loss is because of extra calculations needed when the column is taller. Builderboy: how would you find the height of each segment? That seems to require quite a bit of math.

Bricks!


I'm contemplating rewriting everything to use only integer arithmetic. Do you guys think the resulting speed gain will be worth the trouble?

I attached a new demo. Why doesn't the forum support .tns attachments?
« Last Edit: March 26, 2010, 08:05:20 pm by bwang »

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 #62 on: March 26, 2010, 08:00:20 pm »
Mmm could you multiply the height of the section by .03125?  Would that be faster than dividing by 32?  This way there wouldnt be any extra calculations for taller columns, only the overhead of drawing the pixels.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nspire Raycaster
« Reply #63 on: March 26, 2010, 08:38:20 pm »
I will add tns attachment support asap, sorry I kinda forgot since it was not a commonly-used file on the forums until Ndless came out :P

Also looks nice so far ^^.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline AaroneusTheGreat

  • Moderator
  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 287
  • Rating: +26/-1
    • View Profile
Re: Nspire Raycaster
« Reply #64 on: March 26, 2010, 09:54:47 pm »
Wow the new 32x32 bit textures look great. I would highly suggest studying the code from the FAT engine, it was able to render 64x64 bit textures on a 10mhz calc (although it was only rendering to a 96x96 pixel screen), you've got a lot more processor speed to work with, despite the fact that your engine uses the whole screen, I think you could use some of the optimization concepts from that engine in your code.

Also do you  have a maximum distance for rendering coded in yet? if not you could glean a few FPS's of speed from not even bothering with tiles that are outside of that distance. You probably have, but that's just a thought. At a certain distance and beyond, the walls would all render as a single pixel in each column, so there's no real need to calculate anything at that distance and beyond. It would make more sense to just render a pixel.

Also after a certain distance, you could just abandon textures, and just render the wall as a solid color, like black would be good, because it would appear that you just couldn't see that texture, and it would probably speed things up a bit.

Just a couple of thoughts. I tried writing a raycasting engine for the HP50g once, and only managed to make a really fish-eyed representation of the walls, and only in one color, so I think your expertise in these matters severely outweighs mine ;D

Good work! Keep it up! It won't be long and I might be working on a Wolfenstein port for the nSpire.

« Last Edit: March 26, 2010, 09:56:23 pm by AaroneusTheGreat »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nspire Raycaster
« Reply #65 on: March 26, 2010, 10:11:46 pm »
is it very hard to detect if some stuff is located farther?
« Last Edit: March 26, 2010, 10:13:06 pm by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #66 on: March 26, 2010, 10:37:18 pm »
Good idea, I'll add the maximum distance code.
calc84: how do you change the CPU clock speed in C?

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 #67 on: March 27, 2010, 03:37:11 pm »
Good idea, I'll add the maximum distance code.
calc84: how do you change the CPU clock speed in C?
To set 150MHz, do this:
Code: [Select]
*(unsigned*)0x900B0000 = 0x00000002;
*(unsigned*)0x900B000C = 4;

To set 90MHz, do this:
Code: [Select]
*(unsigned*)0x900B0000 = 0x00141002;
*(unsigned*)0x900B000C = 4;
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #68 on: March 28, 2010, 03:33:48 am »
Just out of curiosity, what do the bits in 0x00000002 and 0x00141002 do?
« Last Edit: March 28, 2010, 02:34:20 pm by bwang »

Offline tifreak

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2708
  • Rating: +82/-3
  • My Kung Fu IS strong...
    • View Profile
    • TI-Freakware
Re: Nspire Raycaster
« Reply #69 on: March 28, 2010, 09:35:02 am »
Very very impressive project thus far.

Question I have is will it support being able to look up and down? A user on my forums (SuperKoolKid) was going to make an engine for the 68k that allowed that, but he has seemingly stopped the project due to not having the time or motivation to work on it.

If you did, we could have some really epic games made. XD
Projects: AOD Series: 75% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nspire Raycaster
« Reply #70 on: March 28, 2010, 12:27:17 pm »
(on a offtopic note I wonder where SuperKoolkid went..., his engine would have been amazing. Only Calc84maniac did that besides SKK and he didn't release a demo yet, not to mention it's dormant
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline bwang

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 634
  • Rating: +30/-11
    • View Profile
Re: Nspire Raycaster
« Reply #71 on: March 28, 2010, 02:37:04 pm »
Quote
Question I have is will it support being able to look up and down?
That depends on how computationally intensive looking up and down is, how much speed I have left after adding sprites, and how much I can optimize the code.

calc84: The clock speed changing code you posted doesn't seem to do anything. Is there a special way I have to use it, or can I just stick it anywhere in my code?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Nspire Raycaster
« Reply #72 on: March 28, 2010, 02:42:19 pm »
Is it a calc-only feature or will it work on emulator too?
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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 #73 on: March 28, 2010, 02:55:50 pm »
I don't think it works on the emulator. Also, check http://hackspire.unsads.com/wiki/index.php/Memory-mapped_I/O_ports#900B0000_-_Power_management for information on what the bits do.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Nspire Raycaster
« Reply #74 on: March 28, 2010, 06:21:42 pm »
Very very impressive project thus far.

Question I have is will it support being able to look up and down? A user on my forums (SuperKoolKid) was going to make an engine for the 68k that allowed that, but he has seemingly stopped the project due to not having the time or motivation to work on it.

If you did, we could have some really epic games made. XD

I fairly sure no matter what epic games are in the near future ;D
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)