New demo uploaded: Wolfenstein 3D - raycasting demo with textures

All aspects of programming on the Commander X16.
Jeffrey
Posts: 62
Joined: Fri Feb 19, 2021 9:46 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Jeffrey »



7 minutes ago, Ed Minchau said:




There's something else that might speed things up for you on the programming side: you can write assembly language code that writes assembly language code. Lots of what you're writing is just various LDA VERA_DAT_1 and STA VERA_DAT_0 in various combinations. You could pick some vertical scale to display, say 152 pixels, and have an assembly language routine generate all of those height scale subroutines for you automatically. 



Yes. I do that now. I generate 512 routines for 512 possible heights. See my previous posts about it.

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Ed Minchau »



18 hours ago, Jeffrey said:




Yes. I do that now. I generate 512 routines for 512 possible heights. See my previous posts about it.



OK, due to VERA's autoincrement you're actually going to have faster software than the original Wolfenstein. 8 cycles per pixel instead of 15.  This version might be better than the original.

Jeffrey
Posts: 62
Joined: Fri Feb 19, 2021 9:46 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Jeffrey »



2 hours ago, Ed Minchau said:




OK, due to VERA's autoincrement you're actually going to have faster software than the original Wolfenstein. 8 cycles per pixel instead of 15.  This version might be better than the original.



I doubt it. The 286 was 16 bit and apparently they capable of writing 2 pixels at the time to VGA. They reached 60 fps i believe.

We could maybe reach 15 fps (when I do some hand calculations). And thats hard.

User avatar
Cyber
Posts: 482
Joined: Mon Apr 27, 2020 7:36 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Cyber »



34 minutes ago, Jeffrey said:




We could maybe reach 15 fps (when I do some hand calculations). And thats hard.



With appropriate graphics even 10 fps can be pretty pleasant to look at. So I think It's worth a shot.

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Ed Minchau »



3 hours ago, Jeffrey said:




I doubt it. The 286 was 16 bit and apparently they capable of writing 2 pixels at the time to VGA. They reached 60 fps i believe.



We could maybe reach 15 fps (when I do some hand calculations). And thats hard.



If you do exactly like wolfenstein you'll have the same limitations with an 8bit machine, yeah. But there's shortcuts that they didn't try until Doom like binary space partition that could help. 

Jeffrey
Posts: 62
Joined: Fri Feb 19, 2021 9:46 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Jeffrey »



24 minutes ago, Ed Minchau said:




If you do exactly like wolfenstein you'll have the same limitations with an 8bit machine, yeah. But there's shortcuts that they didn't try until Doom like binary space partition that could help. 



Yes. Those sort of shortcuts will help (although I am starting now with how Wolf 3D did the raycastings).

A more fundamental problem is the cycle budget: blitting 304*152 pixels using 8 cycles per pixel takes around 370k cycles. Per vsync tick we only have 133k cycles available. So 60fps seems out of reach for the x16.

Thats without doing any raycasting/space partitioning, sprite scaling, AI etc.

But thats ok. Im fine with 10-15fps. ?

Jeffrey
Posts: 62
Joined: Fri Feb 19, 2021 9:46 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Jeffrey »


Its starting to work in assembly:

raycasting_with_textures.gif

Right now its about 5fps. Can be improved quite a bit. I'll have to do some cleaning up and I would like to add some small features (maybe more than one texture). Then I'll probably release a new version.

Have fun! ?

Jeff Pare
Posts: 32
Joined: Fri May 08, 2020 3:31 am

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Jeff Pare »


Very nice - the speed improvements are already impressive!

Ed Minchau
Posts: 503
Joined: Sat Jul 11, 2020 3:30 pm

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by Ed Minchau »



12 hours ago, Jeffrey said:




Yes. Those sort of shortcuts will help (although I am starting now with how Wolf 3D did the raycastings).



A more fundamental problem is the cycle budget: blitting 304*152 pixels using 8 cycles per pixel takes around 370k cycles. Per vsync tick we only have 133k cycles available. So 60fps seems out of reach for the x16.



Thats without doing any raycasting/space partitioning, sprite scaling, AI etc.



But thats ok. Im fine with 10-15fps. ?



I did a video demo about 18 months ago that did 10fps, and I thought it looked OK. My upcoming demo is 20 fps but it's 160x68, and it looks great. Anything in that 10-12-15 fps range should be good. 

If you could get away with a vertical stretch, 304x96x8 = 233472, so maybe 20 fps is possible?

User avatar
desertfish
Posts: 1097
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

New demo uploaded: Wolfenstein 3D - raycasting demo with textures

Post by desertfish »


If you make the textures mirrored across the Y axis you can cut the required texture samples in half again, and just mirror the bottom half from the upper half of the screen.

Don't know if you wanna do this because it may start looking really ugly if the textures are constrained this way perhaps....

Also for non-wall textures (monster sprites?) this surely is a nasty restriction

Post Reply