Author Topic: YABR - (Yet Another BASIC Raycaster)  (Read 2392 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
YABR - (Yet Another BASIC Raycaster)
« on: June 16, 2013, 09:02:22 am »
I have never before gotten a raycaster to work, but I may have finally gotten a version to work in BASIC. It is incredibly slow, but if the code is correct, then this means I will be able to use it as a basis for converting it to other languages (like Axe, Assembly, Grammer). I know raycasters have been made many times, but I am glad to finally have made one myself :)

How I did it: Basically, I read through a tutorial, tried to convert the C code to BASIC, failed (most likely a typo) then I tried it again a few days later and I made it properly (I think). I modified some of the code to optimise it for speed, I made some inputs as constants, and I made the viewing direction based on an angle measure instead of a vector. So essentially, there are three inputs-- the player (x,y) coordinate in the map and the angle at which they are turned. Also, the map data is stored in the last 31 columns of pixels on the graph screen.

I am pretty sure that there is still something wrong with the code, but I will try to work that out. As an example of what seems to be going wrong, if the viewing angle is 270 degrees (down) it seems that the rays only sweep from 270 degrees to about 315 instead of 225 to 315.


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: YABR - (Yet Another BASIC Raycaster)
« Reply #1 on: June 16, 2013, 10:53:53 am »
Lol nice actually. I think Calc84maniac's raycaster was way faster but it seemed kinda buggy or maybe the keys were not mapped correctly. I have to wonder, though, how fast would this run in HP 39gII or Prime BASIC, knowing these calcs are much faster with that language (10 FPS for an horizontal scrolling tunnel clone)? If the speed is proportional to the CPU (assuming the interpreter is the same quality as on TI), then maybe we could get at least 3 FPS if using lower resolution (the calc has rectangle routines and they're as fast as pxl-on/line(). Only For/If/While/maths really slow things down)
« Last Edit: June 16, 2013, 10:55:53 am by DJ Omnimaga »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: YABR - (Yet Another BASIC Raycaster)
« Reply #2 on: June 17, 2013, 07:30:31 am »
That's pretty cool, and it is slow, but it is basic, so it is awesome :D Great job :)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!