Nice program!
It's like the other Raycaster Engine made at the old Ezboard Forums. That one was great: cell shaded walls and ran really fast!
The only problem with your one is the speed, no offence, but the other Raycaster engine ran really smooth, sometimes abit too fast. Maybe if you tried to change some sequences to cut out some slow down? You could look at the other engine's code below to see if you could change something.
::This was coded by laurenz
I changed a few things:
Before, you could not move with to buttons pressed.
I modified this using if and(j,num)<>0 turn=turn+1 Before, the map was behind the shaded walls, making it invisible when you went close to the walls.
I modified this by moving the map code after the wall drwaing code.
I added a slowdown option, located as SLOWDOWN=0. Increase this value to slow the program's frame reat down.
NB/ The program uses Binary for the map data. Jim told me this when i asked how to change the map.
Put the value into your computers calculator and set it to BIN.
open window 640,512
slowdown=0
dim grid(42,54)
dim cs(360),sn(360)
data 66714624,66584830,34145280
data 34078858,116383736,116391819
data 10485768,77594664,130015208
data 128966563,66600,34099362
data 130088,66605310,66613288
data 66706686,34099240,34145418,112188654
data 49248171,10486914,35672104,117431534
data 49272803,35672104,34083970,60837928
data 66591998,27385070,58850304,18941058
data 42009600,123854010,50296831,4214946
data 33570816,130145518,66025455,66690
data 2688040,130302,3800104,130302,238
data 87170,130,134174595,16773307,57
data 8392872,134174603,12570795,87178
data 10506370,130286,10506494,66714760
data 62410814,34145416,34099234,101676942
data 48783331,20482,34095104,101703662
data 62422927,34078760,10485896,66584632
data 10486008,0,60947710,0,35718274
data 0,50272131,0,33558529,0,50296707
data 0,35734658,0,65142014
for y=0 to 41
read a,b
for x=0 to 26
decode=2^(26-x)
if decode>b then
grid(y,x)=0
else
grid(y,x)=1
b=b-decode
fi
decode=2^(26-x)
if decode>a then
grid(y,x+27)=0
else
grid(y,x+27)=1
a=a-decode
fi
next x
next y
factor=(atan(1)*8)/360
for a=0 to 359
ang=a*factor
sn(a)=sin(ang)*.1
cs(a)=cos(ang)*.1
next a
px=3
py=1
head=182
label main
setdispbuf db
db=1-db
setdrawbuf db
setrgb 1,0,100,130
fill rectangle 0,0 to 640,256
setrgb 1,40,40,40
fill rectangle 0,256 to 640,512
j=peek("port1")
if and(j,32)<>0 head=mod(head+5,360)
if and(j,128)<>0 head=mod(head+360-5,360)
if and(j,16)<>0 then
newpx=px-(sn(head))*3
newpy=py-(cs(head))*3
if grid(newpx,newpy)=0 then
px=newpx
py=newpy
fi
fi
if and(j,64)<>0 then
newpx=px+(sn(head))*3
newpy=py+(cs(head))*3
if grid(newpx,newpy)=0 then
px=newpx
py=newpy
fi
fi
x1=0
for sc=head-31 to head+32 step 2
ang=mod(sc,359)
if ang<0 ang=ang+359
spx=sn(ang)
spy=cs(ang)
setrgb 1,255,0,0
fill box 320+px*2,56+py*2,322+px*2,58+py*2
xx=px
yy=py
l=0
repeat
xx=xx-spx
yy=yy-spy
l=l+1
k=grid(xx,yy)
until (k>0)
dd=1024/l
h=dd+dd
dt=256-dd
setrgb 1,140-dt*.5,140-dt*.5,140-dt*.5
fill box x1,dt,x1+20,256+h*.5
setrgb 1,0,0,0
box x1+2,dt+2,x1+20-2,256+h*.05
box x1+20-2,256+h*.05,x1+2,256+h*.5
x1=x1+20
next sc
for y=0 to 53
for x=0 to 41
if grid(x,y)>0 then
setrgb 1,0,0,0
fill box 320+x*2,56+y*2 to 322+x*2,58+y*2
fi
next x
next y
wait slowdown
goto main
Overall, a great piece of code. Very nice graphical effects with the bricks!