I was told it couldn't be done.
albeit by the non-programmer typesThat got me agitated, so I did it.
I made the first (to my knowledge) completely pure TI-Basic raycaster.
For those who don't know what raycasting is, it is a method of drawing a 3D environment from a 2D map.
It is also my area of expertiseJust input any 10x10 matrix in to [A], then it will render the first screen.
For example, I loaded the matrix displayed as a demo on the CC19 thread into [A], and got this:
There are a few things to notice:
The minimap, on the bottom right. Believe it or not, this is essential to the program, as it does all of its detection and ray projection on it. I also spent more time making the bevel look right then anything else. (This is an old version, and I forgot to put a marker for where the player is.)
The shading, which represents distance. I chose this color shading, as it was easier on the eyes. In theory, you could easily edit the program to do any color of shading you want.
The glitch, slightly left of center. This is a WIP, but I doubt I will be able to fix that. (as it is due to the way I am calculating my rays' paths/intersections, and there is no other efficient way.)
This program is
not complete and I have a bit left to implement. Here we go:
1) Optimization. Currently, the 'game' is unplayable, as it takes it like 2 min to render a screen. Most of this is due to the programming language, but some of it can probably be sped up.
2) Key recognition. Not only is the 'game' too slow to be played, it does not recognize any keypresses. This is due to the fact that I wanted to post this early so you guys could all see it. Compared to the main bits, this should be really easy. (but still take awhile, arbitrary rotation measurements are not fun to work with. For example, looking forward (right on minimap) is 310 degrees. Don't ask me why.) Complete! (wow that was quick!)
3) Prettifying the code. Perhaps.
4) You tell me. I don't really know where to go with this...
litrosaist had a speed modification. x2
womp shows me I cannot type. x2
Code here, but movement is all screwed up:
Degree
0→Xmin
{BLACK,DARKGRAY,GRAY,MEDGRAY,LTGRAY,WHITE,WHITE→L₁
70→Xmax
-20→Ymin
20→Ymax
310→R
119→S
219→T
Lbl RD
ClrDraw
For(A,1,51,1
For(B,1,100,50
Pxl-On(163-A,263-B,GRAY
Pxl-On(163-B,263-A,GRAY
Pxl-On(164-A,264-B,GRAY
Pxl-On(110+A,210+B,MEDGRAY
Pxl-On(110+B,210+A,MEDGRAY
Pxl-On(109+B,209+A,MEDGRAY
Pxl-On(109+A,209+B,MEDGRAY
End
End
For(A,1,10
For(B,1,10
If [A](A,B
Then
For(C,1,5
For(D,1,5
Pxl-On(110+(5A-4+C),210+(5B-4+D),BLACK
End
End
End
End
End
DelVar N
For(A,70-R,1-R,1
N+1→N
DelVar C
cos(A→P
sin(A→Q
Repeat Ans
C+1→C
pxl-Test(int(S+CP),int(T+CQ
End
If C<20:Then
int(C/3→V
For(B,int(40/C)/2,int(40/C)/2
For(D,1,2
Pt-On(N,B,D,L₁(V
End
End
End
End
Pxl-On(S,T
Repeat Ans
getKey
End
If K=24
R-2→R
If K=26
R+2→R
If K=25
Then
int(S+5cos(R→S
int(T+5sin(R→T
Else
If K=34
Then
int(S-5cos(R→S
int(T-5sin(R→T
End
End
If K=45:Stop
Goto RD
Also: There is now a code golf happening with this code!! Who ever can get it the fastest wins a small banner (for sig) and (maybe) some karma or something.
Formula (for score):
speed^2+2size