a while ago I just thought 'huh, why is the raycaster calc84 so fast?' Since I am no computer science genius, I decided to test it using the scientific method, using code similiar to this:
DEF WP SP,X,Y,Z'weak perspective(basically perspective minus camera rotation) VAR X%,Y% IF Z == 0 THEN X% = 200:Y% = 120:SCL = 1 ELSE SCL = 1/Z X% = (X/Z) + 200 Y% = 120 - (Y/Z) SPSCALE SP,SCL,SCL SPOFS SP,X%,Y% END DEF WP2 VAR X%,Y% IF SPVAR(CALLIDX,2) == 0 THEN X% = 200:Y% = 120:SCL = 1 ELSE SCL = 1/Z X% = (SPVAR(CALLIDX,0)/SPVAR(CALLIDX,2)) + 200 Y% = 120 - (SPVAR(CALLIDX,1)/SPVAR(CALLIDX,2)) SPSCALE CALLIDX,SCL,SCL SPOFS CALLIDX,X%,Y% END '----initialize---- VAR X = RND(100),Y=RND(100),Z=RND(10) FOR I = 0 TO 511 SPSET I,0 SPVAR I,0,X SPVAR I,1,Y SPVAR I,2,Z SPFUNC I,WP2 NEXT 'now the testing begins: M% = MILLISEC FOR I = 0 TO 511 WP I,X,Y,Z NEXT FORTIME% = MILLISEC-M% M% = MILLISEC CALL SPRITE CALLSPTIME% = MILLISEC - M%