4 ms·
The first (and only one, currently) comment brought me back years ago! A major performance trick back then was to ensure the code and data would remain into the
by thibaut_barrere 16y ago
The first (and only one, currently) comment brought me back years ago! A major performance trick back then was to ensure the code and data would remain into the (very small) cache, as well as preferring structures that would be read in order.
====================
"Because walls were rendered as columns, wall textures were stored in memory rotated 90 degrees to the left. This was done to reduce the amount of computation required for texture coordinates"
The real reason is faster memory acces when reading linearly on old machine, less cpu cache clear. It's an old trick used on smooth rotozoomer effect in demo scene year ago.
- thedjinn 16y agoActually, rotating a texture 90 degrees in memory when making a rotozoomer still results in large amounts of cache misses depending on the current rotation angle. In order to get a smooth rotozoomer effect you have to use a technique called block rendering. This means you divide the image in square cells and render these one by one. Because the pixels in the cell are always near eachother you can reduce cache misses. There is an old snippet from Niklas Beisert floating around the web that explains exactly how this works.
- thibaut_barrere 16y agoYup :) Here's the code if someone is interested: ftp://latvia.tucows.com/pub/mirror/x2ftp/msdos/programming/demosrc/pasroto.zip (I managed to find it back thanks to hornet.org) Edit: you can also check out the list at ftp://latvia.tucows.com/pub/mirror/x2ftp/msdos/programming/demosrc/00index.txt
- dman 16y agoThanks for digging this up. Much appreciated.
- CamperBob 16y agoActually, the real reason was that Doom ran in "Mode X", where it was actually faster to rasterize vertical strips rather than horizontal ones. This worked out especially well in Wolf3D and Doom, since perspective correction in the vertical direction was never needed.
- simcop2387 16y agoActually it didn't it ran in the bog standard 320x200 256 color mode. mostly because using "mode x" back then wasn't as widely supported on lots of low end machines. mov ax, 13h int 10h ah those were the days.
- CamperBob 16y agoAfraid not. (http://www.idsoftware.com/wolfenstein3dclassic/wolfdevelopment.htm http://www.idsoftware.com/wolfenstein3dclassic/wolfdevelopme..., "Programming notes")
- andrewf 16y agoLooking at the Doom source, it seems that the actual 3D game view was rendered into a linear buffer, and subsequently blitted onto the mode X surface. Some UI elements went straight to the screen. (The DOS Doom source was never publicly released, just the Linux port, but there are remnants of some DOS code in the archive. I'm specifically looking at R_DrawSpan in README.asm and V_DrawPatchDirect in v_video.c)
- simcop2387 16y agoThat may be where my misunderstanding came from then, didn't realize the original dos version wasn't what was released.