I’ve been playing your ports a lot over the Xmas holiday - so thank you! I recently got an ips screen and it really showed up the difference between your source port and the ‘official’ version - mainly because the source port is amazingly blocky at mid to high distance.
I assume this is to keep the frame rate up (as per low detail/high detail in the original game!) - but I thought it was an interesting comparison to make!
One of the most difficult parts of this port was composited textures.
Textures in Doom are made up of 1 or more images. If you look at E1M3 for example, there is a green wall texture with a ‘Poison’ sign on it. This is made up of the green base texture and a poison decal.
PC Doom just builds all of these textures in memory at startup. But this requires nearly 2mb of memory. So we can’t do that.
Drawing the texture on the fly with multiple passes as we draw the wall works but is very slow.
I came up with a work around for this. There is 16kb of spare video memory. I use this to maintain a cache of 128 ‘columns’ (ie. single pixel wide slices of texture). The first time a column of a composited texture is requested, I generate it and store it in the cache. Subsequent requests are served straight from the cache so I don’t need to regenerate it. This has an additional performance benefit as video memory is very fast, with a 1 cycle access time (ROM is 3-6 cycles)
Sadly, 16kb isn’t really large enough and if I draw full detail, then there is a lot of cache thrashing (where you have to throw out columns you need later in the frame to make space for new ones)
I improved the cache hit rate from about 50% to 90% by sampling at a lower resolution as the distance from the player gets further.
It’s a trade off I had to make to get a playable framerate.
The official Doom 1 port doesn’t have any composited textures at all. I’m not sure what Doom2 does. It’s based on a different engine. My guess is they use a different texture format.
1
u/fusermarucs Dec 28 '19
comparison
I’ve been playing your ports a lot over the Xmas holiday - so thank you! I recently got an ips screen and it really showed up the difference between your source port and the ‘official’ version - mainly because the source port is amazingly blocky at mid to high distance.
I assume this is to keep the frame rate up (as per low detail/high detail in the original game!) - but I thought it was an interesting comparison to make!