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

All aspects of programming on the Commander X16.
Post Reply
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 »


Another thing I was thinking about was the Wolf3D textures.  The originals are 64 x 64 bitmaps.  I just imported that PNG into Paint, resized it horizontally by 50% and then resized again by 200% and saved as a 256 color bitmap, attached.  Now the images are all still 64 x 64 but every second column is identical. and this can be resized horizontally to give 32 x 64 images (the second attached image), doubling the number of textures that can be stored in VERA at one time.

edited to add: tried again squashing the images vertically instead, and it looks better (wolf3dwalls3.bmp)

one more: tried again in IrfanView, which resized and resampled using better methods than Paint.  wolf3dwalls5 is squashed vertically by 50%, and 5a is the same file stretched back out to 64 pixels per image again to give a comparison to the original images.  So, the drawing routines could be smaller (LDA a maximum of 32 times for a wall column rather than 64, plus one LDA for the ceiling and another for the floor, and only 128 STA instructions if Vscale is $22) and hence faster.

wolf3dwalls.bmp wolf3dwalls2.bmp

wolf3dwalls3.bmp

wolf3dwalls5.bmp wolf3dwalls5a.bmp

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 »


OK, tried once again with IrfanView, but this time I decreased the color depth to 256 colors first and then did the resizing.  wolf3dwalls6 is squashed vertically to 32 pixels high per texture, and 6a is the same image with every row of pixels doubled.  There's not much difference visually between the original image and 6a.

 

Edit: oops. That didn't work any better nevermind.

wolf3dwalls6.bmp wolf3dwalls6a.bmp

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 »


OK, I think this is the best one yet, the wolf3d textures at half height in 256 colors.  Using these would increase the speed and double the number of textures stored in VERA at once, at the expense of making everything kinda blurry in the y axis.


wolf3dwallsA2.bmp
User avatar
svenvandevelde
Posts: 488
Joined: Wed Dec 23, 2020 6:30 am
Location: Belgium, Antwerpen

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

Post by svenvandevelde »


Hi Jeffrey. This is impressive and congratulations on your achievement. It must have been quite a ride for you to achieve this result. Kudos!

KICKC home page by Jesper Gravgaard.
My KICKC alpha with Commander X16 extensions.
User avatar
DusanStrakl
Posts: 127
Joined: Sun Apr 26, 2020 9:15 pm
Location: Bay Area, California
Contact:

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

Post by DusanStrakl »


I have nothing to add to this ?, I am just here to say it is very impressive what you achieved so far and I am looking forward to more progress.

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

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

Post by Jeffrey »



On 3/17/2021 at 3:23 PM, ZeroByte said:




It's a shame that OPL and OPM are totally different animals, otherwise the AdLib sound is also right there for the playing, too. I DL'd the Wolf3d source to look into that possibility, but haven't come up with any ideas for how to convert between the two on the fly.



Where did you find the originel sound files? Do hou have and tips to rest about these kinds of FM systems/chips? I sound probably use some help on the sound/music front ? 

ZeroByte
Posts: 714
Joined: Wed Feb 10, 2021 2:40 pm

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

Post by ZeroByte »



11 hours ago, Jeffrey said:




Where did you find the originel sound files? Do hou have and tips to rest about these kinds of FM systems/chips? I sound probably use some help on the sound/music front ? 



I didn't get all that deep into it but I did get to where I was reading some portion - I can't recall whether it was the high-level calls from the main loop, or the low-level stuff that actually wrote data to the chip - lol. I am actually interested in digging deeper on that front. I've done some research on OPL, and the good news is that it's probably easier to translate OPL -> OPM than going the other way, because OPL was only a 2-operator synth while the OPM has 4 - but the OPL has more voices, and can work in a mode where many of them are drums - don't know which way Wolf3d worked, but I'm thinking they probably used the 9-voice mode because there wasn't a lot of percussion in the music as I recall, and they also used FM voices for SFX in addition to music.

I suspect that the SFX data files themselves live in the game's MAP files or other data files - they're obviously not going to be in the source.  So I just downloaded the shareware installer and am about to go take a gander.

Interstingly enough for the record, the stated system requirements for Wolf3d are 286/12 with 570K RAM

Ender
Posts: 220
Joined: Sat May 09, 2020 9:32 pm

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

Post by Ender »


I don't really know how to use it, but have you thought about using the floating point library in the kernel to do multiply with fraction part? It's possible it might be faster than your implementation.  Although it might involve costly conversions which would balance it out anyway... (I honestly have no idea, I haven't done any research into it, just throwing it out there).

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

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

Post by Jeffrey »



1 hour ago, Ender said:




I don't really know how to use it, but have you thought about using the floating point library in the kernel to do multiply with fraction part? It's possible it might be faster than your implementation.  Although it might involve costly conversions which would balance it out anyway... (I honestly have no idea, I haven't done any research into it, just throwing it out there).



Thanks for the idea. ?

I'm pretty sure though that doing floating point math on a 6502 CPU (for this purpose) is slower than doing fixed point processing. The 6502 is not well optimized for doing floating point math.

Floating point numbers are (in general) probably easier to deal with, since handling fixed point 8 or 16 bit numbers means a lot off fiddling to make everything fit and not "break". Floating point numbers have a real advantage when it comes to conveniency. And if the CPU (or GPU) is hardware-optimized for it, its most definitely the better solution.

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

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

Post by Jeffrey »


Short update

The latest release (version 1.2.0) ran at 5 fps.

My local version now runs at 7.5 fps ?? Around a 50% gain in speed.

I'm currently optimizing the dda-algorithm. So far I did two things:

Still more speed to be gained ?

Post Reply